@zip.js/zip.js 2.6.10 → 2.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-deno/mc-zip.js +1 -1
- package/dist/zip-fs-full.js +21 -8
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +21 -8
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +21 -8
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +21 -8
- package/dist/zip.min.js +1 -1
- package/index.d.ts +71 -3
- package/lib/core/util/cp437-decode.js +12 -5
- package/lib/core/zip-writer.js +9 -3
- package/package.json +15 -6
- package/tests/all/loader.html +2 -4
- package/tests/all/test-abort-signal-read.js +0 -1
- package/tests/all/test-abort-signal-write.js +0 -1
- package/tests/all/test-array.js +3 -1
- package/tests/all/test-base64.js +3 -1
- package/tests/all/test-blob.js +5 -1
- package/tests/all/test-codecs-interoperability.js +3 -1
- package/tests/all/test-crc.js +7 -12
- package/tests/all/test-crypto.js +3 -1
- package/tests/all/test-custom-io.js +3 -1
- package/tests/all/test-data-descriptor-signature.js +7 -1
- package/tests/all/test-data-descriptor.js +7 -1
- package/tests/all/test-duplicated-filename.js +24 -0
- package/tests/all/test-empty.js +3 -1
- package/tests/all/test-extended-timestamp.js +3 -1
- package/tests/all/test-extra-field.js +3 -2
- package/tests/all/test-fflate-no-worker.js +3 -1
- package/tests/all/test-fflate.js +3 -1
- package/tests/all/test-fs-base64.js +3 -1
- package/tests/all/test-fs-export-options.js +3 -1
- package/tests/all/test-fs-http-import.js +3 -1
- package/tests/all/test-fs-http-reader.js +3 -1
- package/tests/all/test-fs-replace.js +3 -1
- package/tests/all/test-fs-streams.js +3 -1
- package/tests/all/test-fs-text.js +3 -1
- package/tests/all/test-fs-unzip-store.js +3 -1
- package/tests/all/test-fs.js +3 -1
- package/tests/all/test-http-crypto.js +3 -2
- package/tests/all/test-http-range.js +3 -2
- package/tests/all/test-http-zip64.js +3 -2
- package/tests/all/test-invalid-crc.js +3 -1
- package/tests/all/test-no-worker.js +3 -1
- package/tests/all/test-pako-no-worker.js +3 -1
- package/tests/all/test-pako.js +3 -1
- package/tests/all/test-parallel-reads.js +3 -1
- package/tests/all/test-parallel-writes-auto-buffered.js +3 -1
- package/tests/all/test-parallel-writes-ordered.js +4 -2
- package/tests/all/test-parallel-writes.js +3 -1
- package/tests/all/test-readable-stream.js +8 -12
- package/tests/all/test-readable-zip-stream.js +3 -2
- package/tests/all/test-safe-closing.js +3 -1
- package/tests/all/test-store.js +9 -1
- package/tests/all/test-sw-worker.js +0 -1
- package/tests/all/test-sw.js +0 -1
- package/tests/all/test-worker-timeout.js +7 -12
- package/tests/all/test-wrapped.js +4 -2
- package/tests/all/test-writable-stream.js +23 -25
- package/tests/all/test-zip64-auto.js +3 -1
- package/tests/all/test-zip64-crypto.js +3 -1
- package/tests/all/test-zip64.js +3 -1
- package/tests/all/test-zipcrypto.js +3 -1
- package/tests/node-runner.js +17 -9
- package/tests/tests-data.js +1 -0
- package/build.sh +0 -3
- package/tests/run-tests.sh +0 -3
package/dist/zip-full.js
CHANGED
|
@@ -7079,14 +7079,21 @@
|
|
|
7079
7079
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7080
7080
|
*/
|
|
7081
7081
|
|
|
7082
|
+
/* global TextDecoder */
|
|
7083
|
+
|
|
7082
7084
|
const CP437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");
|
|
7085
|
+
const VALID_CP437 = CP437.length == 256;
|
|
7083
7086
|
|
|
7084
|
-
var decodeCP437 = stringValue => {
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7087
|
+
var decodeCP437 = (stringValue) => {
|
|
7088
|
+
if (VALID_CP437) {
|
|
7089
|
+
let result = "";
|
|
7090
|
+
for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
|
|
7091
|
+
result += CP437[stringValue[indexCharacter]];
|
|
7092
|
+
}
|
|
7093
|
+
return result;
|
|
7094
|
+
} else {
|
|
7095
|
+
return new TextDecoder().decode(stringValue);
|
|
7088
7096
|
}
|
|
7089
|
-
return result;
|
|
7090
7097
|
};
|
|
7091
7098
|
|
|
7092
7099
|
/*
|
|
@@ -7766,6 +7773,7 @@
|
|
|
7766
7773
|
options,
|
|
7767
7774
|
config: getConfiguration(),
|
|
7768
7775
|
files: new Map(),
|
|
7776
|
+
filenames: new Set(),
|
|
7769
7777
|
offset: writer.size || 0,
|
|
7770
7778
|
pendingCompressedSize: 0,
|
|
7771
7779
|
pendingEntries: [],
|
|
@@ -7784,9 +7792,17 @@
|
|
|
7784
7792
|
workers++;
|
|
7785
7793
|
let promiseAddFile;
|
|
7786
7794
|
try {
|
|
7795
|
+
name = name.trim();
|
|
7796
|
+
if (zipWriter.filenames.has(name)) {
|
|
7797
|
+
throw new Error(ERR_DUPLICATED_NAME);
|
|
7798
|
+
}
|
|
7799
|
+
zipWriter.filenames.add(name);
|
|
7787
7800
|
promiseAddFile = addFile(zipWriter, name, reader, options);
|
|
7788
7801
|
pendingAddFileCalls.add(promiseAddFile);
|
|
7789
7802
|
return await promiseAddFile;
|
|
7803
|
+
} catch (error) {
|
|
7804
|
+
zipWriter.filenames.delete(name);
|
|
7805
|
+
throw error;
|
|
7790
7806
|
} finally {
|
|
7791
7807
|
pendingAddFileCalls.delete(promiseAddFile);
|
|
7792
7808
|
workers--;
|
|
@@ -7823,9 +7839,6 @@
|
|
|
7823
7839
|
} else {
|
|
7824
7840
|
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
|
|
7825
7841
|
}
|
|
7826
|
-
if (zipWriter.files.has(name)) {
|
|
7827
|
-
throw new Error(ERR_DUPLICATED_NAME);
|
|
7828
|
-
}
|
|
7829
7842
|
const rawFilename = encodeText(name);
|
|
7830
7843
|
if (rawFilename.length > MAX_16_BITS) {
|
|
7831
7844
|
throw new Error(ERR_INVALID_ENTRY_NAME);
|