From 21c2c72889c63f851c3322f2e5a454062c639362 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 16 Aug 2026 22:22:51 +0000 Subject: [PATCH] shares: harden single-file shares some more; motivated by a bug-report that couldn't be reproduced and also didn't make sense, a "hallucination" as they call it? (was submitted by an autonomous bot or something, man) so this should make no difference aside from removing footguns --- copyparty/authsrv.py | 9 ++++++++- copyparty/httpcli.py | 14 +++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 688f466e..a5997bb7 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -2764,7 +2764,7 @@ class AuthSrv(object): for k in drop: t = 'cannot enable [%s] for volume "/%s" because this requires one of the following: e2d / e2ds / e2dsa (either as volflag or global-option)' - if not (enshare and vp.startswith(shrs)): + if not (enshare and vol.vpath.startswith(shrs)): self.log(t % (k, vol.vpath), 1) vol.flags.pop(k) @@ -3214,6 +3214,13 @@ class AuthSrv(object): shn.dbpath = o_vn.dbpath shn.histpath = o_vn.histpath + zs = "assert_root daw dk dks dky e2ds e2dsa e2ts e2tsr fk fka landmark opds rss scan th_pregen" + for zs2 in zs.split(" "): + shn.flags.pop(zs2, None) + zs = "srch_excl srch_re_dots srch_re_nodot th_coversd th_coversl" + for zs2 in zs.split(" "): + shn.flags[zs2] = [] + # root.all_aps doesn't include any shares, so make a copy where the # share appears in all abspaths it can provide (for example for chk_ap) ap = shn.realpath diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 23727495..7559fba4 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -4378,7 +4378,7 @@ class HttpCli(object): mfile2 = "{}.{:.3f}.{}".format(fname, srv_lastmod, fext) dp = "" - hist_cfg = dbv.flags["md_hist"] + hist_cfg = vfs.flags["md_hist"] if hist_cfg == "v": vrd = vsplit(vrem)[0] zb = hashlib.sha512(afsenc(vrd)).digest() @@ -4401,7 +4401,7 @@ class HttpCli(object): pass if dp: atomic_move(self.log, fp, os.path.join(dp, mfile2), vfs.flags) - nmax = dbv.flags["md_nhist"] + nmax = vfs.flags["md_nhist"] if nmax: zs = r"%s\.[0-9]+\.[0-9]{3}\.%s" ptn = re.compile(zs % (re.escape(fname), re.escape(fext))) @@ -7082,10 +7082,10 @@ class HttpCli(object): and (use_filekey or use_dirkey or (not is_dir and "fk" not in vn.flags)) ): if th_fmt is not None: - nothumb = "dthumb" in dbv.flags + nothumb = "dthumb" in vn.flags if is_dir: vrem = vrem.rstrip("/") - cvs = dbv.flags["th_coversl"] + cvs = vn.flags["th_coversl"] if nothumb or not cvs: pass elif icur and vrem: @@ -7831,7 +7831,7 @@ class HttpCli(object): ).urn item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T"),) - if "rmagic" in self.vn.flags: + if "rmagic" in vf: ap = "%s/%s" % (fsroot, item["name"]) item["mime"] = guess_mime(item["name"], ap) else: @@ -7841,8 +7841,8 @@ class HttpCli(object): if ( not self.args.th_no_jpg and self.thumbcli - and "dthumb" not in dbv.flags - and "dithumb" not in dbv.flags + and "dthumb" not in vf + and "dithumb" not in vf ): item["jpeg_thumb_href"] = href + "&th=jf" item["jpeg_thumb_href_hires"] = item["jpeg_thumb_href"] + "3"