Skip to content

Commit

Permalink
Merge branch 'master' of github.com:augustl/js-unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
augustl committed Feb 12, 2010
2 parents 13aa7b1 + 4320dae commit d84798d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if (unzipper.isZipFile()) {
var uncompressed = entry.data;
} else if (entry.compressionMethod === 8) {
// Deflated
var uncompressed = JSInflater.inflate(entry.data);
var uncompressed = JSInflate.inflate(entry.data);
}
}
}</code></pre>
Expand Down
18 changes: 12 additions & 6 deletions js-unzip.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

this.entries = [];
var e = new JSUnzip.ZipEntry(this.fileContents);
while (e.data) {
while (typeof(e.data) === "string") {
this.entries.push(e);
e = new JSUnzip.ZipEntry(this.fileContents);
}
Expand All @@ -35,18 +35,24 @@
this.compressionMethod = binaryStream.getNextBytesAsNumber(2);
this.timeBlob = binaryStream.getNextBytesAsNumber(4);

if (this.isEncrypted() ||
this.isUsingUtf8() ||
this.isUsingBit3TrailingDataDescriptor()) {
return;
if (this.isEncrypted()) {
throw "File contains encrypted entry. Not supported.";
}

if (this.isUsingUtf8()) {
throw "File is using UTF8. Not supported.";
}

if (this.isUsingBit3TrailingDataDescriptor()) {
throw "File is using bit 3 trailing data descriptor. Not supported.";
}

this.crc32 = binaryStream.getNextBytesAsNumber(4);
this.compressedSize = binaryStream.getNextBytesAsNumber(4);
this.uncompressedSize = binaryStream.getNextBytesAsNumber(4);

if (this.isUsingZip64()) {
return;
throw "File is using Zip64 (4gb+ file size). Not supported";
}

this.fileNameLength = binaryStream.getNextBytesAsNumber(2);
Expand Down

0 comments on commit d84798d

Please sign in to comment.