mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
up2k-hasher robustness:
webdav clients tend to upload and then immediately delete files to test for write-access and available disk space, so don't crash and burn when that happens
This commit is contained in:
parent
32ab65d7cb
commit
bac733113c
|
@ -3921,10 +3921,21 @@ class Up2k(object):
|
|||
self.n_hashq -= 1
|
||||
# self.log("hashq {}".format(self.n_hashq))
|
||||
|
||||
ptop, vtop, rd, fn, ip, at, usr, skip_xau = self.hashq.get()
|
||||
task = self.hashq.get()
|
||||
if len(task) != 8:
|
||||
raise Exception("invalid hash task")
|
||||
|
||||
try:
|
||||
if not self._hash_t(task):
|
||||
return
|
||||
except Exception as ex:
|
||||
self.log("failed to hash %s: %s" % (task, ex), 1)
|
||||
|
||||
def _hash_t(self, task: tuple[str, str, str, str, str, float, str, bool]) -> bool:
|
||||
ptop, vtop, rd, fn, ip, at, usr, skip_xau = task
|
||||
# self.log("hashq {} pop {}/{}/{}".format(self.n_hashq, ptop, rd, fn))
|
||||
if "e2d" not in self.flags[ptop]:
|
||||
continue
|
||||
return True
|
||||
|
||||
abspath = djoin(ptop, rd, fn)
|
||||
self.log("hashing " + abspath)
|
||||
|
@ -3936,7 +3947,7 @@ class Up2k(object):
|
|||
else:
|
||||
hashes = self._hashlist_from_file(abspath)
|
||||
if not hashes:
|
||||
return
|
||||
return False
|
||||
|
||||
wark = up2k_wark_from_hashlist(self.salt, inf.st_size, hashes)
|
||||
|
||||
|
@ -3961,6 +3972,8 @@ class Up2k(object):
|
|||
with self.rescan_cond:
|
||||
self.rescan_cond.notify_all()
|
||||
|
||||
return True
|
||||
|
||||
def hash_file(
|
||||
self,
|
||||
ptop: str,
|
||||
|
|
Loading…
Reference in a new issue