From e70ecd98ef96cea87fea2d6bc0d488e615f1fdc2 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 8 Dec 2023 01:01:10 +0000 Subject: [PATCH] don't freak out when deleting a broken symlink, also invoke the hooks with the corret lastmod time --- copyparty/up2k.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 84d4ca74..0ddba707 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -3194,7 +3194,13 @@ class Up2k(object): break abspath = djoin(adir, fn) - st = bos.stat(abspath) + st = stl = bos.lstat(abspath) + if stat.S_ISLNK(st.st_mode): + try: + st = bos.stat(abspath) + except: + pass + volpath = "{}/{}".format(vrem, fn).strip("/") vpath = "{}/{}".format(dbv.vpath, volpath).strip("/") self.log("rm {}\n {}".format(vpath, abspath)) @@ -3207,7 +3213,7 @@ class Up2k(object): vpath, "", uname, - st.st_mtime, + stl.st_mtime, st.st_size, ip, 0, @@ -3237,7 +3243,7 @@ class Up2k(object): vpath, "", uname, - st.st_mtime, + stl.st_mtime, st.st_size, ip, 0,