diff --git a/copyparty/cfg.py b/copyparty/cfg.py index 9ea72c4f..4c584dc5 100644 --- a/copyparty/cfg.py +++ b/copyparty/cfg.py @@ -2,7 +2,7 @@ from __future__ import print_function, unicode_literals # awk -F\" '/add_argument\("-[^-]/{print(substr($2,2))}' copyparty/__main__.py | sort | tr '\n' ' ' -zs = "a c e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vp e2vu ed emp i j lo mcr mte mth mtm mtp nb nc nid nih nw p q s ss sss v z zv" +zs = "a c e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vp e2vu ed emp i j lo mcr mte mth mtm mtp nb nc nid nih nth nw p q s ss sss v z zv" onedash = set(zs.split()) diff --git a/copyparty/ftpd.py b/copyparty/ftpd.py index e17e45c3..c94c6cc6 100644 --- a/copyparty/ftpd.py +++ b/copyparty/ftpd.py @@ -163,7 +163,7 @@ class FtpFs(AbstractedFS): t = "Unsupported characters in [{}]" raise FSE(t.format(vpath), 1) - fn = sanitize_fn(fn or "", "", [".prologue.html", ".epilogue.html"]) + fn = sanitize_fn(fn or "", "") vpath = vjoin(rd, fn) vfs, rem = self.hub.asrv.vfs.get(vpath, self.uname, r, w, m, d) if not vfs.realpath: diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 099f56f7..ca1e31ca 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1804,7 +1804,7 @@ class HttpCli(object): if rnd: fn = rand_name(fdir, fn, rnd) - fn = sanitize_fn(fn or "", "", [".prologue.html", ".epilogue.html"]) + fn = sanitize_fn(fn or "", "") path = os.path.join(fdir, fn) @@ -2547,7 +2547,7 @@ class HttpCli(object): self.gctx = vpath vpath = undot(vpath) vfs, rem = self.asrv.vfs.get(vpath, self.uname, False, True) - rem = sanitize_vpath(rem, "/", []) + rem = sanitize_vpath(rem, "/") fn = vfs.canonical(rem) if not fn.startswith(vfs.realpath): self.log("invalid mkdir [%s] [%s]" % (self.gctx, vpath), 1) @@ -2594,7 +2594,7 @@ class HttpCli(object): if not ext or len(ext) > 5 or not self.can_delete: new_file += ".md" - sanitized = sanitize_fn(new_file, "", []) + sanitized = sanitize_fn(new_file, "") if not nullwrite: fdir = vfs.canonical(rem) @@ -2673,9 +2673,7 @@ class HttpCli(object): # fallthrough fdir = fdir_base - fname = sanitize_fn( - p_file or "", "", [".prologue.html", ".epilogue.html"] - ) + fname = sanitize_fn(p_file or "", "") abspath = os.path.join(fdir, fname) suffix = "-%.6f-%s" % (time.time(), dip) if p_file and not nullwrite: diff --git a/copyparty/szip.py b/copyparty/szip.py index ec37016a..6352e21d 100644 --- a/copyparty/szip.py +++ b/copyparty/szip.py @@ -105,7 +105,7 @@ def gen_hdr( ret += spack(b" str: return "/".join(ret) -def sanitize_fn(fn: str, ok: str, bad: list[str]) -> str: +def sanitize_fn(fn: str, ok: str) -> str: if "/" not in ok: fn = fn.replace("\\", "/").split("/")[-1] - if fn.lower() in bad: - fn = "_" + fn - if ANYWIN: remap = [ ["<", "<"], @@ -2014,9 +2011,9 @@ def sanitize_fn(fn: str, ok: str, bad: list[str]) -> str: return fn.strip() -def sanitize_vpath(vp: str, ok: str, bad: list[str]) -> str: +def sanitize_vpath(vp: str, ok: str) -> str: parts = vp.replace(os.sep, "/").split("/") - ret = [sanitize_fn(x, ok, bad) for x in parts] + ret = [sanitize_fn(x, ok) for x in parts] return "/".join(ret)