mirror of
https://github.com/9001/copyparty.git
synced 2025-10-12 11:32:20 -06:00
fix ftp append (#914)
previously, the target file would always be unlinked upon upload resume, contrary to what the client expects (open for append). when a client sends an APPE, pyftpdlib will `ftp_STOR(file, "a")` which is something that should be allowed within the ftp-wt grace period
This commit is contained in:
parent
f2caab6119
commit
33b0cd5a34
|
@ -251,7 +251,7 @@ class FtpFs(AbstractedFS):
|
||||||
|
|
||||||
if w and need_unlink:
|
if w and need_unlink:
|
||||||
if td >= -1 and td <= self.args.ftp_wt:
|
if td >= -1 and td <= self.args.ftp_wt:
|
||||||
# within permitted timeframe; unlink and accept
|
# within permitted timeframe; allow overwrite or resume
|
||||||
do_it = True
|
do_it = True
|
||||||
elif self.args.no_del or self.args.ftp_no_ow:
|
elif self.args.no_del or self.args.ftp_no_ow:
|
||||||
# file too old, or overwrite not allowed; reject
|
# file too old, or overwrite not allowed; reject
|
||||||
|
@ -268,7 +268,9 @@ class FtpFs(AbstractedFS):
|
||||||
if not do_it:
|
if not do_it:
|
||||||
raise FSE("File already exists")
|
raise FSE("File already exists")
|
||||||
|
|
||||||
wunlink(self.log, ap, VF_CAREFUL)
|
# Don't unlink file for append mode
|
||||||
|
elif "a" not in mode:
|
||||||
|
wunlink(self.log, ap, VF_CAREFUL)
|
||||||
|
|
||||||
ret = open(fsenc(ap), mode, self.args.iobuf)
|
ret = open(fsenc(ap), mode, self.args.iobuf)
|
||||||
if w and "fperms" in vfs.flags:
|
if w and "fperms" in vfs.flags:
|
||||||
|
|
Loading…
Reference in a new issue