mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
up2k: discard empty PARTIALs
This commit is contained in:
parent
46e70d50b7
commit
634657bea1
|
@ -335,6 +335,7 @@ class Up2k(object):
|
||||||
"name",
|
"name",
|
||||||
"size",
|
"size",
|
||||||
"lmod",
|
"lmod",
|
||||||
|
"poke",
|
||||||
]:
|
]:
|
||||||
job[k] = cj[k]
|
job[k] = cj[k]
|
||||||
|
|
||||||
|
@ -458,9 +459,8 @@ class Up2k(object):
|
||||||
db.execute("delete from up where rp = ?", (rp,))
|
db.execute("delete from up where rp = ?", (rp,))
|
||||||
|
|
||||||
def db_add(self, db, wark, rp, ts, sz):
|
def db_add(self, db, wark, rp, ts, sz):
|
||||||
db.execute(
|
v = (wark, ts, sz, rp)
|
||||||
"insert into up values (?,?,?,?)", (wark, ts, sz, rp,),
|
db.execute("insert into up values (?,?,?,?)", v)
|
||||||
)
|
|
||||||
|
|
||||||
def _get_wark(self, cj):
|
def _get_wark(self, cj):
|
||||||
if len(cj["name"]) > 1024 or len(cj["hash"]) > 512 * 1024: # 16TiB
|
if len(cj["name"]) > 1024 or len(cj["hash"]) > 512 * 1024: # 16TiB
|
||||||
|
@ -563,10 +563,15 @@ class Up2k(object):
|
||||||
for job in rm:
|
for job in rm:
|
||||||
del reg[job["wark"]]
|
del reg[job["wark"]]
|
||||||
try:
|
try:
|
||||||
# remove the placeholder zero-byte file (keep the PARTIAL)
|
# remove the filename reservation
|
||||||
path = os.path.join(job["ptop"], job["prel"], job["name"])
|
path = os.path.join(job["ptop"], job["prel"], job["name"])
|
||||||
if os.path.getsize(path) == 0:
|
if os.path.getsize(path) == 0:
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
||||||
|
if len(job["hash"]) == len(job["need"]):
|
||||||
|
# PARTIAL is empty, delete that too
|
||||||
|
path = os.path.join(job["ptop"], job["prel"], job["tnam"])
|
||||||
|
os.unlink(path)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue