truncate chunked PUT at sizelimit; closes #1272

This commit is contained in:
ed
2026-02-05 19:56:04 +00:00
parent 16403d8c6c
commit dfadb5a7ba
2 changed files with 17 additions and 3 deletions

View File

@@ -249,9 +249,9 @@ class Lim(object):
return
x = broker.ask(volgetter, ptop)
nbytes, nfiles = x.get()
self.c_vb_v, nfiles = x.get()
if self.vbmax and self.vbmax < nbytes + sz:
if self.vbmax and self.vbmax < self.c_vb_v + sz:
raise Pebkac(400, "volume has exceeded max size")
if self.vnmax and self.vnmax < nfiles + 1:

View File

@@ -2618,9 +2618,23 @@ class HttpCli(object):
else:
f, fn = ren_open(fn, *open_a, **params)
max_sz = 0
if lim and remains < 0:
if lim.vbmax:
max_sz = lim.c_vb_v
if lim.smax and (not max_sz or max_sz > lim.smax):
max_sz = lim.smax
try:
path = os.path.join(fdir, fn)
post_sz, sha_hex, sha_b64 = copier(reader, f, hasher, 0, self.args.s_wr_slp)
post_sz, sha_hex, sha_b64 = copier(
reader, f, hasher, max_sz, self.args.s_wr_slp
)
except:
if max_sz and self.sr.nb >= max_sz:
f.close() # windows
wunlink(self.log, path, vfs.flags)
raise
finally:
f.close()