nameless uploads skip hooks+up2k; closes #1401

This commit is contained in:
ed 2026-04-16 11:03:51 +00:00
parent e00f2b46eb
commit 6fb1287e7f

View file

@ -3719,12 +3719,12 @@ class HttpCli(object):
fdir = fdir_base fdir = fdir_base
fname = sanitize_fn(p_file or "") fname = sanitize_fn(p_file or "")
abspath = os.path.join(fdir, fname)
suffix = "-%.6f-%s" % (time.time(), dip) suffix = "-%.6f-%s" % (time.time(), dip)
if p_file and not nullwrite: if p_file and not nullwrite:
if rnd: if rnd:
fname = rand_name(fdir, fname, rnd) fname = rand_name(fdir, fname, rnd)
abspath = os.path.join(fdir, fname)
open_args = {"fdir": fdir, "suffix": suffix, "vf": vfs.flags} open_args = {"fdir": fdir, "suffix": suffix, "vf": vfs.flags}
if "replace" in self.uparam or "replace" in self.headers: if "replace" in self.uparam or "replace" in self.headers:
@ -3742,7 +3742,7 @@ class HttpCli(object):
tnam = fname = os.devnull tnam = fname = os.devnull
fdir = abspath = "" fdir = abspath = ""
if xbu: if xbu and abspath:
at = time.time() - lifetime at = time.time() - lifetime
hr = runhook( hr = runhook(
self.log, self.log,
@ -3790,7 +3790,7 @@ class HttpCli(object):
else: else:
open_args["fdir"] = fdir open_args["fdir"] = fdir
if p_file and not nullwrite: if abspath:
bos.makedirs(fdir, vf=vfs.flags) bos.makedirs(fdir, vf=vfs.flags)
# reserve destination filename # reserve destination filename
@ -3844,9 +3844,15 @@ class HttpCli(object):
fname = os.devnull fname = os.devnull
raise raise
if not nullwrite: self.conn.nbyte += sz
atomic_move(self.log, tabspath, abspath, vfs.flags) if not abspath:
files.append(
(sz, sha_hex, sha_b64, p_file or "(discarded)", fname, "")
)
tabspath = ""
continue
atomic_move(self.log, tabspath, abspath, vfs.flags)
tabspath = "" tabspath = ""
at = time.time() - lifetime at = time.time() - lifetime
@ -3901,9 +3907,7 @@ class HttpCli(object):
abspath = ap2 abspath = ap2
sz = bos.path.getsize(abspath) sz = bos.path.getsize(abspath)
files.append( files.append((sz, sha_hex, sha_b64, p_file, fname, abspath))
(sz, sha_hex, sha_b64, p_file or "(discarded)", fname, abspath)
)
dbv, vrem = vfs.get_dbv(rem) dbv, vrem = vfs.get_dbv(rem)
self.conn.hsrv.broker.say( self.conn.hsrv.broker.say(
"up2k.hash_file", "up2k.hash_file",
@ -3917,7 +3921,6 @@ class HttpCli(object):
self.uname, self.uname,
True, True,
) )
self.conn.nbyte += sz
except Pebkac: except Pebkac:
self.parser.drop() self.parser.drop()