immediately allow uploading an interrupted and

deleted incomplete upload to another location
This commit is contained in:
ed 2023-08-20 19:16:35 +00:00
parent bd3640d256
commit 135ece3fbd

View file

@ -2400,27 +2400,29 @@ class Up2k(object):
cur = jcur cur = jcur
ptop = None # use cj or job as appropriate ptop = None # use cj or job as appropriate
if job or wark in reg: if not job and wark in reg:
job = job or reg[wark]
if (
job["ptop"] == cj["ptop"]
and job["prel"] == cj["prel"]
and job["name"] == cj["name"]
):
# ensure the files haven't been deleted manually # ensure the files haven't been deleted manually
names = [job[x] for x in ["name", "tnam"] if x in job] rj = reg[wark]
names = [rj[x] for x in ["name", "tnam"] if x in rj]
for fn in names: for fn in names:
path = djoin(job["ptop"], job["prel"], fn) path = djoin(rj["ptop"], rj["prel"], fn)
try: try:
if bos.path.getsize(path) > 0: if bos.path.getsize(path) > 0 or not rj["need"]:
# upload completed or both present # upload completed or both present
break break
except: except:
# missing; restart # missing; restart
if not self.args.nw and not n4g: if not self.args.nw and not n4g:
job = None del reg[wark]
break break
else:
if job or wark in reg:
job = job or reg[wark]
if (
job["ptop"] != cj["ptop"]
or job["prel"] != cj["prel"]
or job["name"] != cj["name"]
):
# file contents match, but not the path # file contents match, but not the path
src = djoin(job["ptop"], job["prel"], job["name"]) src = djoin(job["ptop"], job["prel"], job["name"])
dst = djoin(cj["ptop"], cj["prel"], cj["name"]) dst = djoin(cj["ptop"], cj["prel"], cj["name"])