Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Jan 19, 2021
1 parent 2be7f5e commit a31df46
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dist/zip-fs-full.min.js

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions dist/zip-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,9 +1116,6 @@
}
entry.rawExtraField = dataArray.subarray(offset + 46 + entry.filenameLength, offset + 46 + entry.filenameLength + entry.extraFieldLength);
readCommonFooter(entry, entry, directoryDataView, offset + 6);
if (entry.compressionMethod != 0x0 && entry.compressionMethod != 0x08) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
entry.rawComment = dataArray.subarray(offset + 46 + entry.filenameLength + entry.extraFieldLength, offset + 46
+ entry.filenameLength + entry.extraFieldLength + entry.commentLength);
entry.comment = decodeString(entry.rawComment, entry.bitFlag.languageEncodingFlag ? CHARSET_UTF8 : this.options.commentEncoding || CHARSET_WIN_1252);
Expand Down Expand Up @@ -1149,6 +1146,17 @@
const dataView = new DataView(dataArray.buffer);
const password = options.password === undefined ? this.options.password : options.password;
let inputPassword = password && password.length && password;
if (this.extraFieldAES) {
if (this.extraFieldAES.originalCompressionMethod != 0x63) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
if (this.extraFieldAES.strength != 3) {
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
}
}
if (this.compressionMethod != 0x0 && this.compressionMethod != 0x08) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
if (dataView.getUint32(0, false) != 0x504b0304) {
throw ERR_LOCAL_FILE_HEADER_NOT_FOUND;
}
Expand Down Expand Up @@ -1186,6 +1194,7 @@
dataDescriptor: (rawBitFlag & 0x08) == 0x08,
languageEncodingFlag: (rawBitFlag & 0x0800) == 0x0800
};
directory.encrypted = directory.bitFlag.encrypted;
directory.rawLastModDate = dataView.getUint32(offset + 6, true);
directory.lastModDate = getDate(directory.rawLastModDate);
directory.filenameLength = dataView.getUint16(offset + 22, true);
Expand Down Expand Up @@ -1273,18 +1282,13 @@

function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
if (extraFieldAES) {
if (compressionMethod != 0x63) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
const extraFieldView = new DataView(extraFieldAES.data.buffer);
extraFieldAES.vendorVersion = extraFieldView.getUint8(0);
extraFieldAES.vendorId = extraFieldView.getUint8(2);
const strength = extraFieldView.getUint8(4);
extraFieldAES.compressionMethod = extraFieldView.getUint16(5, true);
if (strength != 3) {
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
}
directory.compressionMethod = extraFieldAES.compressionMethod;
extraFieldAES.strength = strength;
extraFieldAES.originalCompressionMethod = compressionMethod;
directory.compressionMethod = extraFieldAES.compressionMethod = extraFieldView.getUint16(5, true);
} else {
directory.compressionMethod = compressionMethod;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/zip-fs.min.js

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions dist/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,9 +1116,6 @@
}
entry.rawExtraField = dataArray.subarray(offset + 46 + entry.filenameLength, offset + 46 + entry.filenameLength + entry.extraFieldLength);
readCommonFooter(entry, entry, directoryDataView, offset + 6);
if (entry.compressionMethod != 0x0 && entry.compressionMethod != 0x08) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
entry.rawComment = dataArray.subarray(offset + 46 + entry.filenameLength + entry.extraFieldLength, offset + 46
+ entry.filenameLength + entry.extraFieldLength + entry.commentLength);
entry.comment = decodeString(entry.rawComment, entry.bitFlag.languageEncodingFlag ? CHARSET_UTF8 : this.options.commentEncoding || CHARSET_WIN_1252);
Expand Down Expand Up @@ -1149,6 +1146,17 @@
const dataView = new DataView(dataArray.buffer);
const password = options.password === undefined ? this.options.password : options.password;
let inputPassword = password && password.length && password;
if (this.extraFieldAES) {
if (this.extraFieldAES.originalCompressionMethod != 0x63) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
if (this.extraFieldAES.strength != 3) {
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
}
}
if (this.compressionMethod != 0x0 && this.compressionMethod != 0x08) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
if (dataView.getUint32(0, false) != 0x504b0304) {
throw ERR_LOCAL_FILE_HEADER_NOT_FOUND;
}
Expand Down Expand Up @@ -1186,6 +1194,7 @@
dataDescriptor: (rawBitFlag & 0x08) == 0x08,
languageEncodingFlag: (rawBitFlag & 0x0800) == 0x0800
};
directory.encrypted = directory.bitFlag.encrypted;
directory.rawLastModDate = dataView.getUint32(offset + 6, true);
directory.lastModDate = getDate(directory.rawLastModDate);
directory.filenameLength = dataView.getUint16(offset + 22, true);
Expand Down Expand Up @@ -1273,18 +1282,13 @@

function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
if (extraFieldAES) {
if (compressionMethod != 0x63) {
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
}
const extraFieldView = new DataView(extraFieldAES.data.buffer);
extraFieldAES.vendorVersion = extraFieldView.getUint8(0);
extraFieldAES.vendorId = extraFieldView.getUint8(2);
const strength = extraFieldView.getUint8(4);
extraFieldAES.compressionMethod = extraFieldView.getUint16(5, true);
if (strength != 3) {
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
}
directory.compressionMethod = extraFieldAES.compressionMethod;
extraFieldAES.strength = strength;
extraFieldAES.originalCompressionMethod = compressionMethod;
directory.compressionMethod = extraFieldAES.compressionMethod = extraFieldView.getUint16(5, true);
} else {
directory.compressionMethod = compressionMethod;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/zip.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A JavaScript library to zip and unzip files in the browser",
"author": "Gildas Lormeau",
"license": "BSD-3-Clause",
"version": "2.0.2",
"version": "2.0.3",
"keywords": [
"zip",
"unzip",
Expand Down

0 comments on commit a31df46

Please sign in to comment.