mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
nullwrite fixes
This commit is contained in:
parent
4f97d7cf8d
commit
806fac1742
|
@ -545,9 +545,8 @@ class HttpCli(object):
|
||||||
|
|
||||||
bos.makedirs(fdir)
|
bos.makedirs(fdir)
|
||||||
|
|
||||||
open_f = open
|
open_ka = {"fun": open}
|
||||||
open_a = ["wb", 512 * 1024]
|
open_a = ["wb", 512 * 1024]
|
||||||
open_ka = {}
|
|
||||||
|
|
||||||
# user-request || config-force
|
# user-request || config-force
|
||||||
if ("gz" in vfs.flags or "xz" in vfs.flags) and (
|
if ("gz" in vfs.flags or "xz" in vfs.flags) and (
|
||||||
|
@ -588,28 +587,24 @@ class HttpCli(object):
|
||||||
|
|
||||||
self.log("compressing with {} level {}".format(alg, lv.get(alg)))
|
self.log("compressing with {} level {}".format(alg, lv.get(alg)))
|
||||||
if alg == "gz":
|
if alg == "gz":
|
||||||
open_f = gzip.GzipFile
|
open_ka["fun"] = gzip.GzipFile
|
||||||
open_a = ["wb", lv[alg], None, 0x5FEE6600] # 2021-01-01
|
open_a = ["wb", lv[alg], None, 0x5FEE6600] # 2021-01-01
|
||||||
elif alg == "xz":
|
elif alg == "xz":
|
||||||
open_f = lzma.open
|
open_ka = {"fun": lzma.open, "preset": lv[alg]}
|
||||||
open_a = ["wb"]
|
open_a = ["wb"]
|
||||||
open_ka = {"preset": lv[alg]}
|
|
||||||
else:
|
else:
|
||||||
self.log("fallthrough? thats a bug", 1)
|
self.log("fallthrough? thats a bug", 1)
|
||||||
|
|
||||||
params = {
|
suffix = "-{:.6f}-{}".format(time.time(), self.dip)
|
||||||
"suffix": "-{:.6f}-{}".format(time.time(), self.dip),
|
params = {"suffix": suffix, "fdir": fdir}
|
||||||
"fdir": fdir,
|
|
||||||
"fun": open_f,
|
|
||||||
}
|
|
||||||
params.update(open_ka)
|
|
||||||
|
|
||||||
if self.args.nw:
|
if self.args.nw:
|
||||||
params = {}
|
params = {}
|
||||||
fn = os.devnull
|
fn = os.devnull
|
||||||
|
|
||||||
|
params.update(open_ka)
|
||||||
|
|
||||||
if not fn:
|
if not fn:
|
||||||
fn = "put" + params["suffix"]
|
fn = "put" + suffix
|
||||||
|
|
||||||
with ren_open(fn, *open_a, **params) as f:
|
with ren_open(fn, *open_a, **params) as f:
|
||||||
f, fn = f["orz"]
|
f, fn = f["orz"]
|
||||||
|
|
Loading…
Reference in a new issue