mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add deadline for filling data into a reserved filename
This commit is contained in:
parent
1c2c9db8f0
commit
43ff2e531a
|
@ -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("--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("--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("--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("--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("--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, ...)")
|
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, ...)")
|
||||||
|
|
|
@ -1431,7 +1431,7 @@ class HttpCli(object):
|
||||||
# * volflag 'daw' is set
|
# * volflag 'daw' is set
|
||||||
# * and account has delete-access
|
# * and account has delete-access
|
||||||
# or...
|
# or...
|
||||||
# * file exists and is empty
|
# * file exists, is empty, sufficiently new
|
||||||
# * and there is no .PARTIAL
|
# * and there is no .PARTIAL
|
||||||
|
|
||||||
tnam = fn + ".PARTIAL"
|
tnam = fn + ".PARTIAL"
|
||||||
|
@ -1442,6 +1442,7 @@ class HttpCli(object):
|
||||||
not bos.path.exists(os.path.join(fdir, tnam))
|
not bos.path.exists(os.path.join(fdir, tnam))
|
||||||
and bos.path.exists(path)
|
and bos.path.exists(path)
|
||||||
and not bos.path.getsize(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
|
# small toctou, but better than clobbering a hardlink
|
||||||
bos.unlink(path)
|
bos.unlink(path)
|
||||||
|
|
Loading…
Reference in a new issue