diff --git a/copyparty/__main__.py b/copyparty/__main__.py index fe4f0b51..9b8a86e7 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -661,6 +661,7 @@ def add_upload(ap): ap2.add_argument("--dotpart", action="store_true", help="dotfile incomplete uploads, hiding them from clients unless -ed") ap2.add_argument("--plain-ip", action="store_true", help="when avoiding filename collisions by appending the uploader's ip to the filename: append the plaintext ip instead of salting and hashing the ip") ap2.add_argument("--unpost", metavar="SEC", type=int, default=3600*12, help="grace period where uploads can be deleted by the uploader, even without delete permissions; 0=disabled") + ap2.add_argument("--blank-wt", metavar="SEC", type=int, default=300, help="file write grace period (any client can write to a blank file last-modified more recently than SEC seconds ago)") ap2.add_argument("--reg-cap", metavar="N", type=int, default=38400, help="max number of uploads to keep in memory when running without -e2d; roughly 1 MiB RAM per 600") ap2.add_argument("--no-fpool", action="store_true", help="disable file-handle pooling -- instead, repeatedly close and reopen files during upload (very slow on windows)") ap2.add_argument("--use-fpool", action="store_true", help="force file-handle pooling, even when it might be dangerous (multiprocessing, filesystems lacking sparse-files support, ...)") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index c11cd341..df37eafe 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1431,7 +1431,7 @@ class HttpCli(object): # * volflag 'daw' is set # * and account has delete-access # or... - # * file exists and is empty + # * file exists, is empty, sufficiently new # * and there is no .PARTIAL tnam = fn + ".PARTIAL" @@ -1442,6 +1442,7 @@ class HttpCli(object): not bos.path.exists(os.path.join(fdir, tnam)) and bos.path.exists(path) and not bos.path.getsize(path) + and bos.path.getmtime(path) >= time.time() - self.args.blank_wt ): # small toctou, but better than clobbering a hardlink bos.unlink(path)