Skip to content

Commit

Permalink
update built files
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Apr 29, 2024
1 parent 9f15c4f commit 4c99572
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 73 deletions.
38 changes: 25 additions & 13 deletions dist/zip-fs-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -9411,10 +9411,16 @@
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
});
const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
const [filename, comment] = await Promise.all([
decode(rawFilename, filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
decode(rawComment, commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
]);
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
let filename = decode(rawFilename, rawFilenameEncoding);
if (filename === UNDEFINED_VALUE) {
filename = decodeText(rawFilename, rawFilenameEncoding);
}
let comment = decode(rawComment, rawCommentEncoding);
if (comment === UNDEFINED_VALUE) {
comment = decodeText(rawComment, rawCommentEncoding);
}
Object.assign(fileEntry, {
rawComment,
filename,
Expand Down Expand Up @@ -10018,12 +10024,18 @@
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
}
const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
const rawFilename = encode(name);
let rawFilename = encode(name);
if (rawFilename === UNDEFINED_VALUE) {
rawFilename = encodeText(name);
}
if (getLength(rawFilename) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_NAME);
}
const comment = options.comment || "";
const rawComment = encode(comment);
let rawComment = encode(comment);
if (rawComment === UNDEFINED_VALUE) {
rawComment = encodeText(comment);
}
if (getLength(rawComment) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_COMMENT);
}
Expand Down Expand Up @@ -10089,19 +10101,19 @@
dataDescriptor = true;
if (zip64 || zip64 === UNDEFINED_VALUE) {
zip64 = true;
uncompressedSize = maximumCompressedSize = MAX_32_BITS;
uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
}
} else {
uncompressedSize = reader.size;
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
}
}
const { diskOffset, diskNumber, maxSize } = zipWriter.writer;
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset >= MAX_32_BITS;
const zip64UncompressedSize = zip64Enabled || uncompressedSize > MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize > MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset > MAX_32_BITS;
const supportZip64SplitFile = getOptionValue(zipWriter, options, "supportZip64SplitFile", true);
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) >= MAX_16_BITS;
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) > MAX_16_BITS;
if (zip64Offset || zip64UncompressedSize || zip64CompressedSize || zip64DiskNumberStart) {
if (zip64 === false || !keepOrder) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
Expand Down Expand Up @@ -10244,7 +10256,7 @@
fileEntry.offset = zipWriter.offset - diskOffset;
if (fileEntry.zip64) {
setZip64ExtraInfo(fileEntry, options);
} else if (fileEntry.offset >= MAX_32_BITS) {
} else if (fileEntry.offset > MAX_32_BITS) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
}
zipWriter.offset += fileEntry.size;
Expand Down Expand Up @@ -10861,7 +10873,7 @@
lastDiskNumber++;
}
let zip64 = getOptionValue(zipWriter, options, "zip64");
if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS || lastDiskNumber >= MAX_16_BITS) {
if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
if (zip64 === false) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/zip-fs-full.min.js

Large diffs are not rendered by default.

38 changes: 25 additions & 13 deletions dist/zip-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3557,10 +3557,16 @@
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
});
const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
const [filename, comment] = await Promise.all([
decode(rawFilename, filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
decode(rawComment, commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
]);
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
let filename = decode(rawFilename, rawFilenameEncoding);
if (filename === UNDEFINED_VALUE) {
filename = decodeText(rawFilename, rawFilenameEncoding);
}
let comment = decode(rawComment, rawCommentEncoding);
if (comment === UNDEFINED_VALUE) {
comment = decodeText(rawComment, rawCommentEncoding);
}
Object.assign(fileEntry, {
rawComment,
filename,
Expand Down Expand Up @@ -4164,12 +4170,18 @@
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
}
const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
const rawFilename = encode(name);
let rawFilename = encode(name);
if (rawFilename === UNDEFINED_VALUE) {
rawFilename = encodeText(name);
}
if (getLength(rawFilename) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_NAME);
}
const comment = options.comment || "";
const rawComment = encode(comment);
let rawComment = encode(comment);
if (rawComment === UNDEFINED_VALUE) {
rawComment = encodeText(comment);
}
if (getLength(rawComment) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_COMMENT);
}
Expand Down Expand Up @@ -4235,19 +4247,19 @@
dataDescriptor = true;
if (zip64 || zip64 === UNDEFINED_VALUE) {
zip64 = true;
uncompressedSize = maximumCompressedSize = MAX_32_BITS;
uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
}
} else {
uncompressedSize = reader.size;
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
}
}
const { diskOffset, diskNumber, maxSize } = zipWriter.writer;
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset >= MAX_32_BITS;
const zip64UncompressedSize = zip64Enabled || uncompressedSize > MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize > MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset > MAX_32_BITS;
const supportZip64SplitFile = getOptionValue(zipWriter, options, "supportZip64SplitFile", true);
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) >= MAX_16_BITS;
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) > MAX_16_BITS;
if (zip64Offset || zip64UncompressedSize || zip64CompressedSize || zip64DiskNumberStart) {
if (zip64 === false || !keepOrder) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
Expand Down Expand Up @@ -4390,7 +4402,7 @@
fileEntry.offset = zipWriter.offset - diskOffset;
if (fileEntry.zip64) {
setZip64ExtraInfo(fileEntry, options);
} else if (fileEntry.offset >= MAX_32_BITS) {
} else if (fileEntry.offset > MAX_32_BITS) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
}
zipWriter.offset += fileEntry.size;
Expand Down Expand Up @@ -5007,7 +5019,7 @@
lastDiskNumber++;
}
let zip64 = getOptionValue(zipWriter, options, "zip64");
if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS || lastDiskNumber >= MAX_16_BITS) {
if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
if (zip64 === false) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/zip-fs.min.js

Large diffs are not rendered by default.

38 changes: 25 additions & 13 deletions dist/zip-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -7780,10 +7780,16 @@
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
});
const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
const [filename, comment] = await Promise.all([
decode(rawFilename, filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
decode(rawComment, commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
]);
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
let filename = decode(rawFilename, rawFilenameEncoding);
if (filename === UNDEFINED_VALUE) {
filename = decodeText(rawFilename, rawFilenameEncoding);
}
let comment = decode(rawComment, rawCommentEncoding);
if (comment === UNDEFINED_VALUE) {
comment = decodeText(rawComment, rawCommentEncoding);
}
Object.assign(fileEntry, {
rawComment,
filename,
Expand Down Expand Up @@ -8387,12 +8393,18 @@
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
}
const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
const rawFilename = encode(name);
let rawFilename = encode(name);
if (rawFilename === UNDEFINED_VALUE) {
rawFilename = encodeText(name);
}
if (getLength(rawFilename) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_NAME);
}
const comment = options.comment || "";
const rawComment = encode(comment);
let rawComment = encode(comment);
if (rawComment === UNDEFINED_VALUE) {
rawComment = encodeText(comment);
}
if (getLength(rawComment) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_COMMENT);
}
Expand Down Expand Up @@ -8458,19 +8470,19 @@
dataDescriptor = true;
if (zip64 || zip64 === UNDEFINED_VALUE) {
zip64 = true;
uncompressedSize = maximumCompressedSize = MAX_32_BITS;
uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
}
} else {
uncompressedSize = reader.size;
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
}
}
const { diskOffset, diskNumber, maxSize } = zipWriter.writer;
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset >= MAX_32_BITS;
const zip64UncompressedSize = zip64Enabled || uncompressedSize > MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize > MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset > MAX_32_BITS;
const supportZip64SplitFile = getOptionValue(zipWriter, options, "supportZip64SplitFile", true);
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) >= MAX_16_BITS;
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) > MAX_16_BITS;
if (zip64Offset || zip64UncompressedSize || zip64CompressedSize || zip64DiskNumberStart) {
if (zip64 === false || !keepOrder) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
Expand Down Expand Up @@ -8613,7 +8625,7 @@
fileEntry.offset = zipWriter.offset - diskOffset;
if (fileEntry.zip64) {
setZip64ExtraInfo(fileEntry, options);
} else if (fileEntry.offset >= MAX_32_BITS) {
} else if (fileEntry.offset > MAX_32_BITS) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
}
zipWriter.offset += fileEntry.size;
Expand Down Expand Up @@ -9230,7 +9242,7 @@
lastDiskNumber++;
}
let zip64 = getOptionValue(zipWriter, options, "zip64");
if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS || lastDiskNumber >= MAX_16_BITS) {
if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
if (zip64 === false) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/zip-full.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-no-worker-deflate.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-no-worker-inflate.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-no-worker.min.js

Large diffs are not rendered by default.

38 changes: 25 additions & 13 deletions dist/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3557,10 +3557,16 @@
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
});
const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
const [filename, comment] = await Promise.all([
decode(rawFilename, filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
decode(rawComment, commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
]);
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
let filename = decode(rawFilename, rawFilenameEncoding);
if (filename === UNDEFINED_VALUE) {
filename = decodeText(rawFilename, rawFilenameEncoding);
}
let comment = decode(rawComment, rawCommentEncoding);
if (comment === UNDEFINED_VALUE) {
comment = decodeText(rawComment, rawCommentEncoding);
}
Object.assign(fileEntry, {
rawComment,
filename,
Expand Down Expand Up @@ -4164,12 +4170,18 @@
options.directory = name.endsWith(DIRECTORY_SIGNATURE);
}
const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
const rawFilename = encode(name);
let rawFilename = encode(name);
if (rawFilename === UNDEFINED_VALUE) {
rawFilename = encodeText(name);
}
if (getLength(rawFilename) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_NAME);
}
const comment = options.comment || "";
const rawComment = encode(comment);
let rawComment = encode(comment);
if (rawComment === UNDEFINED_VALUE) {
rawComment = encodeText(comment);
}
if (getLength(rawComment) > MAX_16_BITS) {
throw new Error(ERR_INVALID_ENTRY_COMMENT);
}
Expand Down Expand Up @@ -4235,19 +4247,19 @@
dataDescriptor = true;
if (zip64 || zip64 === UNDEFINED_VALUE) {
zip64 = true;
uncompressedSize = maximumCompressedSize = MAX_32_BITS;
uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
}
} else {
uncompressedSize = reader.size;
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
}
}
const { diskOffset, diskNumber, maxSize } = zipWriter.writer;
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset >= MAX_32_BITS;
const zip64UncompressedSize = zip64Enabled || uncompressedSize > MAX_32_BITS;
const zip64CompressedSize = zip64Enabled || maximumCompressedSize > MAX_32_BITS;
const zip64Offset = zip64Enabled || zipWriter.offset + zipWriter.pendingEntriesSize - diskOffset > MAX_32_BITS;
const supportZip64SplitFile = getOptionValue(zipWriter, options, "supportZip64SplitFile", true);
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) >= MAX_16_BITS;
const zip64DiskNumberStart = (supportZip64SplitFile && zip64Enabled) || diskNumber + Math.ceil(zipWriter.pendingEntriesSize / maxSize) > MAX_16_BITS;
if (zip64Offset || zip64UncompressedSize || zip64CompressedSize || zip64DiskNumberStart) {
if (zip64 === false || !keepOrder) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
Expand Down Expand Up @@ -4390,7 +4402,7 @@
fileEntry.offset = zipWriter.offset - diskOffset;
if (fileEntry.zip64) {
setZip64ExtraInfo(fileEntry, options);
} else if (fileEntry.offset >= MAX_32_BITS) {
} else if (fileEntry.offset > MAX_32_BITS) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
}
zipWriter.offset += fileEntry.size;
Expand Down Expand Up @@ -5007,7 +5019,7 @@
lastDiskNumber++;
}
let zip64 = getOptionValue(zipWriter, options, "zip64");
if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS || lastDiskNumber >= MAX_16_BITS) {
if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
if (zip64 === false) {
throw new Error(ERR_UNSUPPORTED_FORMAT);
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/zip.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 4c99572

Please sign in to comment.