diff --git a/copyparty/szip.py b/copyparty/szip.py index ff182033..8b421552 100644 --- a/copyparty/szip.py +++ b/copyparty/szip.py @@ -30,7 +30,7 @@ def dostime2unix(buf): def unixtime2dos(ts): - tt = time.gmtime(ts) + tt = time.gmtime(ts + 1) dy, dm, dd, th, tm, ts = list(tt)[:6] bd = ((dy - 1980) << 9) + (dm << 5) + dd @@ -76,7 +76,7 @@ def gen_hdr(h_pos, fn, sz, lastmod, utf8, crc32, pre_crc): # 4b magic, 2b min-ver ret = b"\x50\x4b\x03\x04" + req_ver else: - # 4b magic, 2b spec-ver, 2b min-ver + # 4b magic, 2b spec-ver (1b compat, 1b os (00 dos, 03 unix)), 2b min-ver ret = b"\x50\x4b\x01\x02\x1e\x03" + req_ver ret += b"\x00" if pre_crc else b"\x08" # streaming @@ -95,23 +95,34 @@ def gen_hdr(h_pos, fn, sz, lastmod, utf8, crc32, pre_crc): fn = sanitize_fn(fn, "/", []) bfn = fn.encode("utf-8" if utf8 else "cp437", "replace").replace(b"?", b"_") + # add ntfs and unix extrafields for utc, add z64 if requested z64_len = len(z64v) * 8 + 4 if z64v else 0 - ret += spack(b"