mirror of
https://github.com/9001/copyparty.git
synced 2026-02-26 05:23:10 -07:00
truncate chunked PUT at sizelimit; closes #1272
This commit is contained in:
parent
16403d8c6c
commit
dfadb5a7ba
|
|
@ -249,9 +249,9 @@ class Lim(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
x = broker.ask(volgetter, ptop)
|
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")
|
raise Pebkac(400, "volume has exceeded max size")
|
||||||
|
|
||||||
if self.vnmax and self.vnmax < nfiles + 1:
|
if self.vnmax and self.vnmax < nfiles + 1:
|
||||||
|
|
|
||||||
|
|
@ -2618,9 +2618,23 @@ class HttpCli(object):
|
||||||
else:
|
else:
|
||||||
f, fn = ren_open(fn, *open_a, **params)
|
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:
|
try:
|
||||||
path = os.path.join(fdir, fn)
|
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:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue