From 24ecad52fe6acdd9e2b5e429ed6372e05c550cfb Mon Sep 17 00:00:00 2001 From: Audionut Date: Sun, 12 Oct 2025 10:23:22 +1000 Subject: [PATCH] only allow within the permitted timeframe --- copyparty/ftpd.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/copyparty/ftpd.py b/copyparty/ftpd.py index aa46bf97..a7b27b22 100644 --- a/copyparty/ftpd.py +++ b/copyparty/ftpd.py @@ -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,7 +269,8 @@ class FtpFs(AbstractedFS): if not do_it: raise FSE("File already exists") - wunlink(self.log, ap, VF_CAREFUL) + elif "a" not in mode: + wunlink(self.log, ap, VF_CAREFUL) ret = open(fsenc(ap), mode, self.args.iobuf) if w and "fperms" in vfs.flags: