mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
webdav: more sensible overwrite logic
This commit is contained in:
parent
89cf7608f9
commit
62499f9b71
|
@ -1244,16 +1244,19 @@ class HttpCli(object):
|
||||||
fn = self.rand_name(fdir, fn, rnd)
|
fn = self.rand_name(fdir, fn, rnd)
|
||||||
|
|
||||||
if is_put and not self.args.no_dav:
|
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
|
# * file exists and is empty
|
||||||
# * there is no .PARTIAL
|
# * and there is no .PARTIAL
|
||||||
|
|
||||||
path = os.path.join(fdir, fn)
|
path = os.path.join(fdir, fn)
|
||||||
tnam = fn + ".PARTIAL"
|
tnam = fn + ".PARTIAL"
|
||||||
if self.args.dotpart:
|
if self.args.dotpart:
|
||||||
tnam = "." + tnam
|
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))
|
not bos.path.exists(os.path.join(fdir, tnam))
|
||||||
and bos.path.exists(path)
|
and bos.path.exists(path)
|
||||||
and not bos.path.getsize(path)
|
and not bos.path.getsize(path)
|
||||||
|
|
Loading…
Reference in a new issue