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
This commit is contained in:
ed 2026-08-16 22:22:51 +00:00
parent 18791c5768
commit 21c2c72889
2 changed files with 15 additions and 8 deletions

View file

@ -2764,7 +2764,7 @@ class AuthSrv(object):
for k in drop: 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)' 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) self.log(t % (k, vol.vpath), 1)
vol.flags.pop(k) vol.flags.pop(k)
@ -3214,6 +3214,13 @@ class AuthSrv(object):
shn.dbpath = o_vn.dbpath shn.dbpath = o_vn.dbpath
shn.histpath = o_vn.histpath 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 # 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) # share appears in all abspaths it can provide (for example for chk_ap)
ap = shn.realpath ap = shn.realpath

View file

@ -4378,7 +4378,7 @@ class HttpCli(object):
mfile2 = "{}.{:.3f}.{}".format(fname, srv_lastmod, fext) mfile2 = "{}.{:.3f}.{}".format(fname, srv_lastmod, fext)
dp = "" dp = ""
hist_cfg = dbv.flags["md_hist"] hist_cfg = vfs.flags["md_hist"]
if hist_cfg == "v": if hist_cfg == "v":
vrd = vsplit(vrem)[0] vrd = vsplit(vrem)[0]
zb = hashlib.sha512(afsenc(vrd)).digest() zb = hashlib.sha512(afsenc(vrd)).digest()
@ -4401,7 +4401,7 @@ class HttpCli(object):
pass pass
if dp: if dp:
atomic_move(self.log, fp, os.path.join(dp, mfile2), vfs.flags) atomic_move(self.log, fp, os.path.join(dp, mfile2), vfs.flags)
nmax = dbv.flags["md_nhist"] nmax = vfs.flags["md_nhist"]
if nmax: if nmax:
zs = r"%s\.[0-9]+\.[0-9]{3}\.%s" zs = r"%s\.[0-9]+\.[0-9]{3}\.%s"
ptn = re.compile(zs % (re.escape(fname), re.escape(fext))) 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)) and (use_filekey or use_dirkey or (not is_dir and "fk" not in vn.flags))
): ):
if th_fmt is not None: if th_fmt is not None:
nothumb = "dthumb" in dbv.flags nothumb = "dthumb" in vn.flags
if is_dir: if is_dir:
vrem = vrem.rstrip("/") vrem = vrem.rstrip("/")
cvs = dbv.flags["th_coversl"] cvs = vn.flags["th_coversl"]
if nothumb or not cvs: if nothumb or not cvs:
pass pass
elif icur and vrem: elif icur and vrem:
@ -7831,7 +7831,7 @@ class HttpCli(object):
).urn ).urn
item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T"),) item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T"),)
if "rmagic" in self.vn.flags: if "rmagic" in vf:
ap = "%s/%s" % (fsroot, item["name"]) ap = "%s/%s" % (fsroot, item["name"])
item["mime"] = guess_mime(item["name"], ap) item["mime"] = guess_mime(item["name"], ap)
else: else:
@ -7841,8 +7841,8 @@ class HttpCli(object):
if ( if (
not self.args.th_no_jpg not self.args.th_no_jpg
and self.thumbcli and self.thumbcli
and "dthumb" not in dbv.flags and "dthumb" not in vf
and "dithumb" not in dbv.flags and "dithumb" not in vf
): ):
item["jpeg_thumb_href"] = href + "&th=jf" item["jpeg_thumb_href"] = href + "&th=jf"
item["jpeg_thumb_href_hires"] = item["jpeg_thumb_href"] + "3" item["jpeg_thumb_href_hires"] = item["jpeg_thumb_href"] + "3"