mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
fix xbu/xau reloc collision-handling;
if a hook relocates a file into a folder where that same file exists with the same filename, the filename-collision-avoidance would kick in, generating a new filename and another copy
This commit is contained in:
parent
41fa6b2552
commit
0a9a807772
|
@ -71,6 +71,9 @@ def main():
|
||||||
## selecting it inside the print at the end:
|
## selecting it inside the print at the end:
|
||||||
##
|
##
|
||||||
|
|
||||||
|
# move all uploads to one specific folder
|
||||||
|
into_junk = {"vp": "/junk"}
|
||||||
|
|
||||||
# create a subfolder named after the filetype and move it into there
|
# create a subfolder named after the filetype and move it into there
|
||||||
into_subfolder = {"vp": ext}
|
into_subfolder = {"vp": ext}
|
||||||
|
|
||||||
|
@ -92,8 +95,8 @@ def main():
|
||||||
by_category = {} # no action
|
by_category = {} # no action
|
||||||
|
|
||||||
# now choose the default effect to apply; can be any of these:
|
# now choose the default effect to apply; can be any of these:
|
||||||
# into_subfolder into_toplevel into_sibling by_category
|
# into_junk into_subfolder into_toplevel into_sibling by_category
|
||||||
effect = {"vp": "/junk"}
|
effect = into_sibling
|
||||||
|
|
||||||
##
|
##
|
||||||
## but we can keep going, adding more speicifc rules
|
## but we can keep going, adding more speicifc rules
|
||||||
|
|
|
@ -3236,7 +3236,7 @@ class Up2k(object):
|
||||||
if hr.get("reloc"):
|
if hr.get("reloc"):
|
||||||
x = pathmod(self.vfs, dst, vp, hr["reloc"])
|
x = pathmod(self.vfs, dst, vp, hr["reloc"])
|
||||||
if x:
|
if x:
|
||||||
zvfs = vfs
|
ud1 = (vfs.vpath, job["prel"], job["name"])
|
||||||
pdir, _, job["name"], (vfs, rem) = x
|
pdir, _, job["name"], (vfs, rem) = x
|
||||||
dst = os.path.join(pdir, job["name"])
|
dst = os.path.join(pdir, job["name"])
|
||||||
job["vcfg"] = vfs.flags
|
job["vcfg"] = vfs.flags
|
||||||
|
@ -3244,7 +3244,8 @@ class Up2k(object):
|
||||||
job["vtop"] = vfs.vpath
|
job["vtop"] = vfs.vpath
|
||||||
job["prel"] = rem
|
job["prel"] = rem
|
||||||
job["name"] = sanitize_fn(job["name"], "")
|
job["name"] = sanitize_fn(job["name"], "")
|
||||||
if zvfs.vpath != vfs.vpath:
|
ud2 = (vfs.vpath, job["prel"], job["name"])
|
||||||
|
if ud1 != ud2:
|
||||||
# print(json.dumps(job, sort_keys=True, indent=4))
|
# print(json.dumps(job, sort_keys=True, indent=4))
|
||||||
job["hash"] = cj["hash"]
|
job["hash"] = cj["hash"]
|
||||||
self.log("xbu reloc1:%d..." % (depth,), 6)
|
self.log("xbu reloc1:%d..." % (depth,), 6)
|
||||||
|
@ -4999,14 +5000,15 @@ class Up2k(object):
|
||||||
if hr.get("reloc"):
|
if hr.get("reloc"):
|
||||||
x = pathmod(self.vfs, ap_chk, vp_chk, hr["reloc"])
|
x = pathmod(self.vfs, ap_chk, vp_chk, hr["reloc"])
|
||||||
if x:
|
if x:
|
||||||
zvfs = vfs
|
ud1 = (vfs.vpath, job["prel"], job["name"])
|
||||||
pdir, _, job["name"], (vfs, rem) = x
|
pdir, _, job["name"], (vfs, rem) = x
|
||||||
job["vcfg"] = vf = vfs.flags
|
job["vcfg"] = vf = vfs.flags
|
||||||
job["ptop"] = vfs.realpath
|
job["ptop"] = vfs.realpath
|
||||||
job["vtop"] = vfs.vpath
|
job["vtop"] = vfs.vpath
|
||||||
job["prel"] = rem
|
job["prel"] = rem
|
||||||
job["name"] = sanitize_fn(job["name"], "")
|
job["name"] = sanitize_fn(job["name"], "")
|
||||||
if zvfs.vpath != vfs.vpath:
|
ud2 = (vfs.vpath, job["prel"], job["name"])
|
||||||
|
if ud1 != ud2:
|
||||||
self.log("xbu reloc2:%d..." % (depth,), 6)
|
self.log("xbu reloc2:%d..." % (depth,), 6)
|
||||||
return self._handle_json(job, depth + 1)
|
return self._handle_json(job, depth + 1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue