From b880516edf8b0abc1afa4d6c2fdb6cafac3eeb4d Mon Sep 17 00:00:00 2001 From: timvisee Date: Mon, 12 Apr 2021 16:04:32 +0200 Subject: [PATCH 1/2] Change archive bit flags to specify use of UTF-8 filenames Related to https://gitlab.com/timvisee/send/-/issues/10#note_549739569 Suggested in https://github.com/mozilla/send/issues/1432#issue-545383226 --- app/zip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/zip.js b/app/zip.js index 1363da82..b80c2c32 100644 --- a/app/zip.js +++ b/app/zip.js @@ -29,7 +29,7 @@ class File { const v = new DataView(h); v.setUint32(0, 0x04034b50, true); // sig v.setUint16(4, 20, true); // version - v.setUint16(6, 8, true); // bit flags (8 = use data descriptor) + v.setUint16(6, 2056, true); // bit flags (2056 = use data descriptor(8) + utf8-encoded(2048)) v.setUint16(8, 0, true); // compression v.setUint16(10, this.dateTime.time, true); // modified time v.setUint16(12, this.dateTime.date, true); // modified date From 709997ba72f3a216070268dc79d30952f3a1b6b4 Mon Sep 17 00:00:00 2001 From: timvisee Date: Fri, 4 Mar 2022 16:48:58 +0100 Subject: [PATCH 2/2] Fix garbled filenames on Windows with ZIP files due to missing UTF-8 flag See https://gitlab.com/timvisee/send/-/issues/10 --- app/zip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/zip.js b/app/zip.js index b80c2c32..57d751cb 100644 --- a/app/zip.js +++ b/app/zip.js @@ -29,7 +29,7 @@ class File { const v = new DataView(h); v.setUint32(0, 0x04034b50, true); // sig v.setUint16(4, 20, true); // version - v.setUint16(6, 2056, true); // bit flags (2056 = use data descriptor(8) + utf8-encoded(2048)) + v.setUint16(6, 0x808, true); // bit flags (use data descriptor(8) + utf8-encoded(8 << 8)) v.setUint16(8, 0, true); // compression v.setUint16(10, this.dateTime.time, true); // modified time v.setUint16(12, this.dateTime.date, true); // modified date @@ -60,7 +60,7 @@ class File { v.setUint32(0, 0x02014b50, true); // sig v.setUint16(4, 20, true); // version made v.setUint16(6, 20, true); // version required - v.setUint16(8, 8, true); // bit flags (8 = use data descriptor) + v.setUint16(8, 0x808, true); // bit flags (use data descriptor(8) + utf8-encoded(8 << 8)) v.setUint16(10, 0, true); // compression v.setUint16(12, this.dateTime.time, true); // modified time v.setUint16(14, this.dateTime.date, true); // modified date