mirror of
https://github.com/9001/copyparty.git
synced 2026-02-19 11:54:58 -05:00
truncate chunked PUT at sizelimit; closes #1272
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user