@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/cli-deno/mc-zip.js
CHANGED
|
@@ -36,7 +36,7 @@ async function displayUsage() {
|
|
|
36
36
|
await stdout.write(" --data-descriptor-signature add data descriptor signatures (default: false)\n");
|
|
37
37
|
await stdout.write(" --keep-order keep entries order (default: true)\n");
|
|
38
38
|
await stdout.write(" --zip64 use Zip64 format (default: false)\n");
|
|
39
|
-
await stdout.write(" --prevent-parent-directories remove occurences of \"../\" in filenames\n");
|
|
39
|
+
await stdout.write(" --prevent-parent-directories remove occurences of \"../\" in filenames (default: true)\n");
|
|
40
40
|
await stdout.write("\n");
|
|
41
41
|
Deno.exit(-1);
|
|
42
42
|
}
|
package/dist/zip-fs-full.js
CHANGED
|
@@ -8080,14 +8080,21 @@
|
|
|
8080
8080
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8081
8081
|
*/
|
|
8082
8082
|
|
|
8083
|
+
/* global TextDecoder */
|
|
8084
|
+
|
|
8083
8085
|
const CP437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");
|
|
8086
|
+
const VALID_CP437 = CP437.length == 256;
|
|
8084
8087
|
|
|
8085
|
-
var decodeCP437 = stringValue => {
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8088
|
+
var decodeCP437 = (stringValue) => {
|
|
8089
|
+
if (VALID_CP437) {
|
|
8090
|
+
let result = "";
|
|
8091
|
+
for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
|
|
8092
|
+
result += CP437[stringValue[indexCharacter]];
|
|
8093
|
+
}
|
|
8094
|
+
return result;
|
|
8095
|
+
} else {
|
|
8096
|
+
return new TextDecoder().decode(stringValue);
|
|
8089
8097
|
}
|
|
8090
|
-
return result;
|
|
8091
8098
|
};
|
|
8092
8099
|
|
|
8093
8100
|
/*
|
|
@@ -8767,6 +8774,7 @@
|
|
|
8767
8774
|
options,
|
|
8768
8775
|
config: getConfiguration(),
|
|
8769
8776
|
files: new Map(),
|
|
8777
|
+
filenames: new Set(),
|
|
8770
8778
|
offset: writer.size || 0,
|
|
8771
8779
|
pendingCompressedSize: 0,
|
|
8772
8780
|
pendingEntries: [],
|
|
@@ -8785,9 +8793,17 @@
|
|
|
8785
8793
|
workers++;
|
|
8786
8794
|
let promiseAddFile;
|
|
8787
8795
|
try {
|
|
8796
|
+
name = name.trim();
|
|
8797
|
+
if (zipWriter.filenames.has(name)) {
|
|
8798
|
+
throw new Error(ERR_DUPLICATED_NAME);
|
|
8799
|
+
}
|
|
8800
|
+
zipWriter.filenames.add(name);
|
|
8788
8801
|
promiseAddFile = addFile(zipWriter, name, reader, options);
|
|
8789
8802
|
pendingAddFileCalls.add(promiseAddFile);
|
|
8790
8803
|
return await promiseAddFile;
|
|
8804
|
+
} catch (error) {
|
|
8805
|
+
zipWriter.filenames.delete(name);
|
|
8806
|
+
throw error;
|
|
8791
8807
|
} finally {
|
|
8792
8808
|
pendingAddFileCalls.delete(promiseAddFile);
|
|
8793
8809
|
workers--;
|
|
@@ -8824,9 +8840,6 @@
|
|
|
8824
8840
|
} else {
|
|
8825
8841
|
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
|
|
8826
8842
|
}
|
|
8827
|
-
if (zipWriter.files.has(name)) {
|
|
8828
|
-
throw new Error(ERR_DUPLICATED_NAME);
|
|
8829
|
-
}
|
|
8830
8843
|
const rawFilename = encodeText(name);
|
|
8831
8844
|
if (rawFilename.length > MAX_16_BITS) {
|
|
8832
8845
|
throw new Error(ERR_INVALID_ENTRY_NAME);
|