From 1034a51bd2f9a52c620740df1e9a957a1de2b6a6 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 11 Apr 2021 17:36:38 +0200 Subject: [PATCH] support ~ paths --- .vscode/launch.py | 1 + copyparty/authsrv.py | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.py b/.vscode/launch.py index 8bbc7d59..9a76fa78 100644 --- a/.vscode/launch.py +++ b/.vscode/launch.py @@ -16,6 +16,7 @@ with open(".vscode/launch.json", "r") as f: oj = jstyleson.loads(tj) argv = oj["configurations"][0]["args"] +argv = [os.path.expanduser(x) if x.startswith("~") else x for x in argv] try: copyparty(argv) except SystemExit as ex: diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 00ff3f4b..76a29d7c 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -233,12 +233,6 @@ class AuthSrv(object): def log(self, msg, c=0): self.log_func("auth", msg, c) - def invert(self, orig): - if PY2: - return {v: k for k, v in orig.iteritems()} - else: - return {v: k for k, v in orig.items()} - def laggy_iter(self, iterable): """returns [value,isFinalValue]""" it = iter(iterable) @@ -495,7 +489,7 @@ class AuthSrv(object): with self.mutex: self.vfs = vfs self.user = user - self.iuser = self.invert(user) + self.iuser = {v: k for k, v in user.items()} # import pprint # pprint.pprint({"usr": user, "rd": mread, "wr": mwrite, "mnt": mount})