From d168b2acacb82e004b3ac6ca80a71e2e4b70a786 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 28 Nov 2024 22:01:18 +0000 Subject: [PATCH] forget all shadowed files (uploads too); closes #120 shadowing is the act of intentinoally blocking off access to files in a volume by placing another volume atop of a file/folder. say you have volume '/' with a file '/a/b/c/d.txt'; if you create a volume at '/a/b', then all files/folders inside the original folder becomes inaccessible, and replaced with the contents of the new vol the initial code for forgetting shadowed files from the parent vol database would only forget files which were discovered during a filesystem scan; any uploaded files would be intentionally preseved in the parent volume's database, probably to avoid losing uploader info in the event of a brief mistaken config change, where a volume is shadowed by accident. this precaution was a mistake, currently causing far more issues than it solves (#61 and #120), so away it goes. huge thanks to @Gremious for doing all the legwork on this! --- copyparty/up2k.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 3f2fa8a0..47174df1 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1652,7 +1652,7 @@ class Up2k(object): # drop shadowed folders for sh_rd in unreg: n = 0 - q = "select count(w) from up where (rd=? or rd like ?||'/%') and +at == 0" + q = "select count(w) from up where (rd=? or rd like ?||'/%')" for sh_erd in [sh_rd, "//" + w8b64enc(sh_rd)]: try: erd_erd = (sh_erd, sh_erd) @@ -1670,7 +1670,7 @@ class Up2k(object): q = "delete from dh where (d = ? or d like ?||'/%')" db.c.execute(q, erd_erd) - q = "delete from up where (rd=? or rd like ?||'/%') and +at == 0" + q = "delete from up where (rd=? or rd like ?||'/%')" db.c.execute(q, erd_erd) tfa += n