only allow within the permitted timeframe

This commit is contained in:
Audionut 2025-10-12 10:23:22 +10:00
parent ab7d285d0b
commit 24ecad52fe

View file

@ -250,9 +250,9 @@ class FtpFs(AbstractedFS):
td = 0
# Don't unlink file for append mode
if w and need_unlink and "a" not in mode:
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
@ -269,6 +269,7 @@ class FtpFs(AbstractedFS):
if not do_it:
raise FSE("File already exists")
elif "a" not in mode:
wunlink(self.log, ap, VF_CAREFUL)
ret = open(fsenc(ap), mode, self.args.iobuf)