@zip.js/zip.js 2.6.10 → 2.6.11
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/dist/zip-fs-full.js +9 -3
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +9 -3
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +9 -3
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +9 -3
- package/dist/zip.min.js +1 -1
- package/index.d.ts +70 -2
- package/lib/core/zip-writer.js +9 -3
- package/package.json +1 -1
- package/tests/all/test-duplicated-filename.js +24 -0
- package/tests/tests-data.js +1 -0
package/dist/zip-fs-full.js
CHANGED
|
@@ -8767,6 +8767,7 @@
|
|
|
8767
8767
|
options,
|
|
8768
8768
|
config: getConfiguration(),
|
|
8769
8769
|
files: new Map(),
|
|
8770
|
+
filenames: new Set(),
|
|
8770
8771
|
offset: writer.size || 0,
|
|
8771
8772
|
pendingCompressedSize: 0,
|
|
8772
8773
|
pendingEntries: [],
|
|
@@ -8785,9 +8786,17 @@
|
|
|
8785
8786
|
workers++;
|
|
8786
8787
|
let promiseAddFile;
|
|
8787
8788
|
try {
|
|
8789
|
+
name = name.trim();
|
|
8790
|
+
if (zipWriter.filenames.has(name)) {
|
|
8791
|
+
throw new Error(ERR_DUPLICATED_NAME);
|
|
8792
|
+
}
|
|
8793
|
+
zipWriter.filenames.add(name);
|
|
8788
8794
|
promiseAddFile = addFile(zipWriter, name, reader, options);
|
|
8789
8795
|
pendingAddFileCalls.add(promiseAddFile);
|
|
8790
8796
|
return await promiseAddFile;
|
|
8797
|
+
} catch (error) {
|
|
8798
|
+
zipWriter.filenames.delete(name);
|
|
8799
|
+
throw error;
|
|
8791
8800
|
} finally {
|
|
8792
8801
|
pendingAddFileCalls.delete(promiseAddFile);
|
|
8793
8802
|
workers--;
|
|
@@ -8824,9 +8833,6 @@
|
|
|
8824
8833
|
} else {
|
|
8825
8834
|
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
|
|
8826
8835
|
}
|
|
8827
|
-
if (zipWriter.files.has(name)) {
|
|
8828
|
-
throw new Error(ERR_DUPLICATED_NAME);
|
|
8829
|
-
}
|
|
8830
8836
|
const rawFilename = encodeText(name);
|
|
8831
8837
|
if (rawFilename.length > MAX_16_BITS) {
|
|
8832
8838
|
throw new Error(ERR_INVALID_ENTRY_NAME);
|