mirror of
https://github.com/codedread/bitjs
synced 2025-10-06 02:39:55 +02:00
Fix unzipper so that it always gets a fresh buffer of data. Remove a debugger statement
This commit is contained in:
parent
ea20a6a518
commit
0d27e9d9c0
3 changed files with 3 additions and 4 deletions
|
@ -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!
|
if (h[0] == 0x52 && h[1] == 0x61 && h[2] == 0x72 && h[3] == 0x21) { // Rar!
|
||||||
unarchiver = new bitjs.archive.Unrarrer(ab, pathToBitJS);
|
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);
|
unarchiver = new bitjs.archive.Unzipper(ab, pathToBitJS);
|
||||||
} else { // Try with tar
|
} else { // Try with tar
|
||||||
unarchiver = new bitjs.archive.Untarrer(ab, pathToBitJS);
|
unarchiver = new bitjs.archive.Untarrer(ab, pathToBitJS);
|
||||||
|
|
|
@ -62,7 +62,7 @@ class TarLocalFile {
|
||||||
this.typeflag = readCleanString(bstream, 1);
|
this.typeflag = readCleanString(bstream, 1);
|
||||||
this.linkname = readCleanString(bstream, 100);
|
this.linkname = readCleanString(bstream, 100);
|
||||||
this.maybeMagic = readCleanString(bstream, 6);
|
this.maybeMagic = readCleanString(bstream, 6);
|
||||||
debugger;
|
|
||||||
if (this.maybeMagic == "ustar") {
|
if (this.maybeMagic == "ustar") {
|
||||||
this.version = readCleanString(bstream, 2);
|
this.version = readCleanString(bstream, 2);
|
||||||
this.uname = readCleanString(bstream, 32);
|
this.uname = readCleanString(bstream, 32);
|
||||||
|
|
|
@ -103,8 +103,7 @@ class ZipLocalFile {
|
||||||
// read in the compressed data
|
// read in the compressed data
|
||||||
this.fileData = null;
|
this.fileData = null;
|
||||||
if (this.compressedSize > 0) {
|
if (this.compressedSize > 0) {
|
||||||
this.fileData = new Uint8Array(bstream.bytes.buffer, bstream.ptr, this.compressedSize);
|
this.fileData = new Uint8Array(bstream.readBytes(this.compressedSize));
|
||||||
bstream.ptr += this.compressedSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: deal with data descriptor if present (we currently assume no data descriptor!)
|
// TODO: deal with data descriptor if present (we currently assume no data descriptor!)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue