diff --git a/.vscode/launch.json b/.vscode/launch.json index f31f411a..f4104c1f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,7 @@ "0", "-nc", "4", - "-nw", + //"-nw", "-a", "ed:wark", "-v", diff --git a/.vscode/settings.json b/.vscode/settings.json index 218a405c..ff8651c0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -43,7 +43,7 @@ "editor.formatOnSave": true, "[html]": { "editor.formatOnSave": false, - } + }, // // things you may wanna edit: // diff --git a/README.md b/README.md index f33cf049..12c0dd9c 100644 --- a/README.md +++ b/README.md @@ -68,4 +68,5 @@ pip install black bandit pylint flake8 # vscode tooling roughly sorted by priority +* last-modified header * support pillow-simd diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index cc1a2404..5c47a866 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -16,7 +16,7 @@ if not PY2: unicode = str from urllib.parse import unquote_plus else: - from urllib import unquote_plus + from urllib import unquote_plus # pylint: disable=no-name-in-module class HttpCli(object): @@ -77,8 +77,8 @@ class HttpCli(object): self.log(self.rvol) self.log(self.wvol) - # split req into vpath + args - args = {} + # split req into vpath + uparam + uparam = {} if "?" not in self.req: if not self.req.endswith("/"): self.absolute_urls = True @@ -93,11 +93,11 @@ class HttpCli(object): for k in arglist.split("&"): if "=" in k: k, v = k.split("=", 1) - args[k.lower()] = v.strip() + uparam[k.lower()] = v.strip() else: - args[k.lower()] = True + uparam[k.lower()] = True - self.args = args + self.uparam = uparam self.vpath = unquote_plus(vpath) try: @@ -148,7 +148,7 @@ class HttpCli(object): return self.tx_file(static_path) # conditional redirect to single volumes - if self.vpath == "" and not self.args: + if self.vpath == "" and not self.uparam: nread = len(self.rvol) nwrite = len(self.wvol) if nread + nwrite == 1: @@ -160,16 +160,18 @@ class HttpCli(object): self.absolute_urls = True # go home if verboten - readable, writable = self.conn.auth.vfs.can_access(self.vpath, self.uname) - if not readable and not writable: + self.readable, self.writable = self.conn.auth.vfs.can_access( + self.vpath, self.uname + ) + if not self.readable and not self.writable: self.log("inaccessible: {}".format(self.vpath)) - self.args = {"h": True} + self.uparam = {"h": True} - if "h" in self.args: + if "h" in self.uparam: self.vpath = None return self.tx_mounts() - if readable: + if self.readable: return self.tx_browser() else: return self.tx_upper() @@ -210,7 +212,8 @@ class HttpCli(object): pwd = u"x" # nosec h = ["Set-Cookie: cppwd={}; Path=/".format(pwd)] - html = u'