@zip.js/zip.js 2.7.41 → 2.7.42

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.
@@ -277,9 +277,10 @@ class ZipReader {
277
277
  commentUTF8,
278
278
  rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
279
279
  });
280
+ const decode = getOptionValue(zipReader, options, "decodeText") || decodeText;
280
281
  const [filename, comment] = await Promise.all([
281
- decodeText(rawFilename, filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
282
- decodeText(rawComment, commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
282
+ decode(rawFilename, filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
283
+ decode(rawComment, commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
283
284
  ]);
284
285
  Object.assign(fileEntry, {
285
286
  rawComment,
@@ -224,12 +224,13 @@ async function addFile(zipWriter, name, reader, options) {
224
224
  } else {
225
225
  options.directory = name.endsWith(DIRECTORY_SIGNATURE);
226
226
  }
227
- const rawFilename = encodeText(name);
227
+ const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
228
+ const rawFilename = encode(name);
228
229
  if (getLength(rawFilename) > MAX_16_BITS) {
229
230
  throw new Error(ERR_INVALID_ENTRY_NAME);
230
231
  }
231
232
  const comment = options.comment || "";
232
- const rawComment = encodeText(comment);
233
+ const rawComment = encode(comment);
233
234
  if (getLength(rawComment) > MAX_16_BITS) {
234
235
  throw new Error(ERR_INVALID_ENTRY_COMMENT);
235
236
  }
@@ -332,7 +333,7 @@ async function addFile(zipWriter, name, reader, options) {
332
333
  zip64DiskNumberStart,
333
334
  password,
334
335
  rawPassword,
335
- level,
336
+ level: !useCompressionStream && zipWriter.config.CompressionStream === UNDEFINED_VALUE ? 0 : level,
336
337
  useWebWorkers,
337
338
  encryptionStrength,
338
339
  extendedTimestamp,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.7.41",
6
+ "version": "2.7.42",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",