From 1231ce199ee7c236c544af3a39f6bd3f4f46e256 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 22 Jan 2025 22:50:03 +0000 Subject: [PATCH] create utf8 zipfiles by default previously, the `?zip` url-suffix would create a cp437 zipfile, and `?zip=utf` would use utf-8, which is now generally expected now, both `?zip=utf` and `?zip` will produce a utf8 zipfile, and `?zip=dos` provides the old behavior --- README.md | 6 +++--- copyparty/httpcli.py | 2 +- copyparty/web/browser.js | 4 ++-- docs/devnotes.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 704d5624..95de4f74 100644 --- a/README.md +++ b/README.md @@ -616,8 +616,8 @@ select which type of archive you want in the `[⚙️] config` tab: | `pax` | `?tar=pax` | pax-format tar, futureproof, not as fast | | `tgz` | `?tar=gz` | gzip compressed gnu-tar (slow), for `curl \| tar -xvz` | | `txz` | `?tar=xz` | gnu-tar with xz / lzma compression (v.slow) | -| `zip` | `?zip=utf8` | works everywhere, glitchy filenames on win7 and older | -| `zip_dos` | `?zip` | traditional cp437 (no unicode) to fix glitchy filenames | +| `zip` | `?zip` | works everywhere, glitchy filenames on win7 and older | +| `zip_dos` | `?zip=dos` | traditional cp437 (no unicode) to fix glitchy filenames | | `zip_crc` | `?zip=crc` | cp437 with crc32 computed early for truly ancient software | * gzip default level is `3` (0=fast, 9=best), change with `?tar=gz:9` @@ -625,7 +625,7 @@ select which type of archive you want in the `[⚙️] config` tab: * bz2 default level is `2` (1=fast, 9=best), change with `?tar=bz2:9` * hidden files ([dotfiles](#dotfiles)) are excluded unless account is allowed to list them * `up2k.db` and `dir.txt` is always excluded -* bsdtar supports streaming unzipping: `curl foo?zip=utf8 | bsdtar -xv` +* bsdtar supports streaming unzipping: `curl foo?zip | bsdtar -xv` * good, because copyparty's zip is faster than tar on small files * `zip_crc` will take longer to download since the server has to read each file twice * this is only to support MS-DOS PKZIP v2.04g (october 1993) and older diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 659f2af7..5dd35164 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -4357,7 +4357,7 @@ class HttpCli(object): self.log, self.asrv, fgen, - utf8="utf" in uarg, + utf8="utf" in uarg or not uarg, pre_crc="crc" in uarg, cmp=uarg if cancmp or uarg == "pax" else "", ) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 68deeeac..f57b037c 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -8635,8 +8635,8 @@ var arcfmt = (function () { ["pax", "tar=pax", L.fz_pax], ["tgz", "tar=gz", L.fz_targz], ["txz", "tar=xz", L.fz_tarxz], - ["zip", "zip=utf8", L.fz_zip8], - ["zip_dos", "zip", L.fz_zipd], + ["zip", "zip", L.fz_zip8], + ["zip_dos", "zip=dos", L.fz_zipd], ["zip_crc", "zip=crc", L.fz_zipc] ]; diff --git a/docs/devnotes.md b/docs/devnotes.md index ffbdb8ca..1f126916 100644 --- a/docs/devnotes.md +++ b/docs/devnotes.md @@ -172,8 +172,8 @@ authenticate using header `Cookie: cppwd=foo` or url param `&pw=foo` | GET | `?tar=xz:9` | ...as an xz-level-9 gnu-tar file | | GET | `?tar=pax` | ...as a pax-tar file | | GET | `?tar=pax,xz` | ...as an xz-level-1 pax-tar file | -| GET | `?zip=utf-8` | ...as a zip file | -| GET | `?zip` | ...as a WinXP-compatible zip file | +| GET | `?zip` | ...as a zip file | +| GET | `?zip=dos` | ...as a WinXP-compatible zip file | | GET | `?zip=crc` | ...as an MSDOS-compatible zip file | | GET | `?tar&w` | pregenerate webp thumbnails | | GET | `?tar&j` | pregenerate jpg thumbnails |