webdav: more sensible overwrite logic

This commit is contained in:
ed 2022-10-30 17:13:06 +00:00
parent 89cf7608f9
commit 62499f9b71

View file

@ -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)