mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
option to hide incomplete uploads
This commit is contained in:
parent
d03e34d55d
commit
58ba71a76f
|
@ -244,6 +244,7 @@ def run_argparse(argv, formatter):
|
|||
ap.add_argument("-nw", action="store_true", help="disable writes (benchmark)")
|
||||
ap.add_argument("-nih", action="store_true", help="no info hostname")
|
||||
ap.add_argument("-nid", action="store_true", help="no info disk-usage")
|
||||
ap.add_argument("--dotpart", action="store_true", help="dotfile incomplete uploads")
|
||||
ap.add_argument("--no-zip", action="store_true", help="disable download as zip/tar")
|
||||
ap.add_argument("--no-sendfile", action="store_true", help="disable sendfile (for debugging)")
|
||||
ap.add_argument("--no-scandir", action="store_true", help="disable scandir (for debugging)")
|
||||
|
|
|
@ -789,12 +789,16 @@ class HttpCli(object):
|
|||
except Pebkac:
|
||||
if fname != os.devnull:
|
||||
fp = os.path.join(fdir, fname)
|
||||
fp2 = fp
|
||||
if self.args.dotpart:
|
||||
fp2 = os.path.join(fdir, "." + fname)
|
||||
|
||||
suffix = ".PARTIAL"
|
||||
try:
|
||||
os.rename(fsenc(fp), fsenc(fp + suffix))
|
||||
os.rename(fsenc(fp), fsenc(fp2 + suffix))
|
||||
except:
|
||||
fp = fp[: -len(suffix)]
|
||||
os.rename(fsenc(fp), fsenc(fp + suffix))
|
||||
fp2 = fp2[: -len(suffix) - 1]
|
||||
os.rename(fsenc(fp), fsenc(fp2 + suffix))
|
||||
|
||||
raise
|
||||
|
||||
|
|
|
@ -1198,6 +1198,9 @@ class Up2k(object):
|
|||
# raise Exception("aaa")
|
||||
|
||||
tnam = job["name"] + ".PARTIAL"
|
||||
if self.args.dotpart:
|
||||
tnam = "." + tnam
|
||||
|
||||
suffix = ".{:.6f}-{}".format(job["t0"], job["addr"])
|
||||
with ren_open(tnam, "wb", fdir=pdir, suffix=suffix) as f:
|
||||
f, job["tnam"] = f["orz"]
|
||||
|
|
Loading…
Reference in a new issue