mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
fix bup into volumes with upload rules
This commit is contained in:
parent
34c4c22e61
commit
46752f758a
|
@ -956,10 +956,14 @@ class HttpCli(object):
|
||||||
vfs, rem = self.asrv.vfs.get(self.vpath, self.uname, False, True)
|
vfs, rem = self.asrv.vfs.get(self.vpath, self.uname, False, True)
|
||||||
self._assert_safe_rem(rem)
|
self._assert_safe_rem(rem)
|
||||||
|
|
||||||
|
upload_vpath = self.vpath
|
||||||
lim = vfs.get_dbv(rem)[0].lim
|
lim = vfs.get_dbv(rem)[0].lim
|
||||||
fdir_base = os.path.join(vfs.realpath, rem)
|
fdir_base = os.path.join(vfs.realpath, rem)
|
||||||
if lim:
|
if lim:
|
||||||
fdir_base, rem = lim.all(self.ip, rem, -1, fdir_base)
|
fdir_base, rem = lim.all(self.ip, rem, -1, fdir_base)
|
||||||
|
upload_vpath = "{}/{}".format(vfs.vpath, rem).strip("/")
|
||||||
|
if not nullwrite:
|
||||||
|
bos.makedirs(fdir_base)
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
errmsg = ""
|
errmsg = ""
|
||||||
|
@ -986,8 +990,6 @@ class HttpCli(object):
|
||||||
if lim:
|
if lim:
|
||||||
lim.chk_bup(self.ip)
|
lim.chk_bup(self.ip)
|
||||||
lim.chk_nup(self.ip)
|
lim.chk_nup(self.ip)
|
||||||
if not nullwrite:
|
|
||||||
bos.makedirs(fdir)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with ren_open(fname, "wb", 512 * 1024, **open_args) as f:
|
with ren_open(fname, "wb", 512 * 1024, **open_args) as f:
|
||||||
|
@ -1038,7 +1040,9 @@ class HttpCli(object):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except Pebkac as ex:
|
except Pebkac as ex:
|
||||||
errmsg = volsan(self.asrv.vfs.all_vols.values(), unicode(ex))
|
errmsg = vol_san(
|
||||||
|
self.asrv.vfs.all_vols.values(), unicode(ex).encode("utf-8")
|
||||||
|
).decode("utf-8")
|
||||||
|
|
||||||
td = max(0.1, time.time() - t0)
|
td = max(0.1, time.time() - t0)
|
||||||
sz_total = sum(x[0] for x in files)
|
sz_total = sum(x[0] for x in files)
|
||||||
|
@ -1058,7 +1062,7 @@ class HttpCli(object):
|
||||||
errmsg = "ERROR: " + errmsg
|
errmsg = "ERROR: " + errmsg
|
||||||
|
|
||||||
for sz, sha512, ofn, lfn in files:
|
for sz, sha512, ofn, lfn in files:
|
||||||
vpath = (self.vpath + "/" if self.vpath else "") + lfn
|
vpath = "{}/{}".format(upload_vpath, lfn).strip("/")
|
||||||
msg += 'sha512: {} // {} bytes // <a href="/{}">{}</a>\n'.format(
|
msg += 'sha512: {} // {} bytes // <a href="/{}">{}</a>\n'.format(
|
||||||
sha512[:56], sz, quotep(vpath), html_escape(ofn, crlf=True)
|
sha512[:56], sz, quotep(vpath), html_escape(ofn, crlf=True)
|
||||||
)
|
)
|
||||||
|
|
|
@ -346,10 +346,8 @@ def log_thrs(log, ival, name):
|
||||||
|
|
||||||
def vol_san(vols, txt):
|
def vol_san(vols, txt):
|
||||||
for vol in vols:
|
for vol in vols:
|
||||||
txt = txt.replace(
|
txt = txt.replace(vol.realpath.encode("utf-8"), vol.vpath.encode("utf-8"))
|
||||||
vol.realpath.encode("utf-8"), vol.vpath.encode("utf-8")
|
|
||||||
)
|
|
||||||
|
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue