From 352b1ed10a52e59ac9bd615bb22bddafc60f3245 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 6 Dec 2021 19:49:14 +0100 Subject: [PATCH] generate correct links when trailing slash missing --- copyparty/httpcli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 354e048a..2c057277 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -2096,6 +2096,7 @@ class HttpCli(object): url_suf = self.urlq({}, []) is_ls = "ls" in self.uparam + is_js = self.cookies.get("js") == "y" tpl = "browser" if "b" in self.uparam: @@ -2213,7 +2214,7 @@ class HttpCli(object): for fn in vfs_ls: base = "" href = fn - if not is_ls and not self.trailing_slash and vpath: + if not is_ls and not is_js and not self.trailing_slash and vpath: base = "/" + vpath + "/" href = base + fn @@ -2356,7 +2357,7 @@ class HttpCli(object): dirs.sort(key=itemgetter("name")) - if self.cookies.get("js") == "y": + if is_js: j2a["ls0"] = {"dirs": dirs, "files": files, "taglist": taglist} j2a["files"] = [] else: