1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-05 18:34:17 +02:00

Fix unzipper so that it always gets a fresh buffer of data. Remove a debugger statement

This commit is contained in:
codedread 2017-02-21 11:45:28 -08:00
parent ea20a6a518
commit 0d27e9d9c0
3 changed files with 3 additions and 4 deletions

View file

@ -335,7 +335,7 @@ bitjs.archive.GetUnarchiver = function(ab, opt_pathToBitJS) {
if (h[0] == 0x52 && h[1] == 0x61 && h[2] == 0x72 && h[3] == 0x21) { // Rar!
unarchiver = new bitjs.archive.Unrarrer(ab, pathToBitJS);
} else if (h[0] == 80 && h[1] == 75) { // PK (Zip)
} else if (h[0] == 0x50 && h[1] == 0x4B) { // PK (Zip)
unarchiver = new bitjs.archive.Unzipper(ab, pathToBitJS);
} else { // Try with tar
unarchiver = new bitjs.archive.Untarrer(ab, pathToBitJS);

View file

@ -62,7 +62,7 @@ class TarLocalFile {
this.typeflag = readCleanString(bstream, 1);
this.linkname = readCleanString(bstream, 100);
this.maybeMagic = readCleanString(bstream, 6);
debugger;
if (this.maybeMagic == "ustar") {
this.version = readCleanString(bstream, 2);
this.uname = readCleanString(bstream, 32);

View file

@ -103,8 +103,7 @@ class ZipLocalFile {
// read in the compressed data
this.fileData = null;
if (this.compressedSize > 0) {
this.fileData = new Uint8Array(bstream.bytes.buffer, bstream.ptr, this.compressedSize);
bstream.ptr += this.compressedSize;
this.fileData = new Uint8Array(bstream.readBytes(this.compressedSize));
}
// TODO: deal with data descriptor if present (we currently assume no data descriptor!)