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:
Audionut 2025-10-12 10:32:51 +10:00 committed by GitHub
parent f2caab6119
commit 33b0cd5a34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -251,7 +251,7 @@ class FtpFs(AbstractedFS):
if w and need_unlink:
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
elif self.args.no_del or self.args.ftp_no_ow:
# file too old, or overwrite not allowed; reject
@ -268,6 +268,8 @@ class FtpFs(AbstractedFS):
if not do_it:
raise FSE("File already exists")
# 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)