From 62499f9b7114f122b48dd80a67057d989ed904bc Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 30 Oct 2022 17:13:06 +0000 Subject: [PATCH] webdav: more sensible overwrite logic --- copyparty/httpcli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 6d5a7d75..7fd6065a 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1244,16 +1244,19 @@ class HttpCli(object): fn = self.rand_name(fdir, fn, rnd) if is_put and not self.args.no_dav: - # allow overwrite if volflag daw is set, or all the following is true: + # allow overwrite if... + # * volflag 'daw' is set + # * and account has delete-access + # or... # * file exists and is empty - # * there is no .PARTIAL + # * and there is no .PARTIAL path = os.path.join(fdir, fn) tnam = fn + ".PARTIAL" if self.args.dotpart: tnam = "." + tnam - if "daw" in vfs.flags or ( + if ("daw" in vfs.flags and self.can_delete) or ( not bos.path.exists(os.path.join(fdir, tnam)) and bos.path.exists(path) and not bos.path.getsize(path)