Skip to content

Commit

Permalink
correctly close start offset of EntryIterators, set maxBufferSize whe…
Browse files Browse the repository at this point in the history
…n cloning DataReader objects
  • Loading branch information
KurtThiemann committed Aug 30, 2022
1 parent 0cef40a commit 1fad66b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Archive/Entry/EntryIterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export default class EntryIterator {
async clone() {
let cloneReader = await this.reader.clone();
cloneReader.seek(this.reader.offset);
return new this.constructor(this.archive, cloneReader, false);

let cloneIterator = new this.constructor(this.archive, cloneReader, false);
cloneIterator.currentEntry = this.currentEntry;
cloneIterator.startOffset = this.startOffset;
return cloneIterator;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Reader/ArrayBufferReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default class ArrayBufferReader extends DataReader {
if (cloneLength === null) {
cloneLength = this.byteLength - cloneOffset;
}
return new this.constructor(this.data.buffer, this.byteOffset + cloneOffset, cloneLength);
return new this.constructor(this.data.buffer, this.byteOffset + cloneOffset, cloneLength)
.setMaxBufferSize(this.bufferSize);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Reader/BrowserFileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export default class BrowserFileReader extends DataReader {
if (cloneLength === null) {
cloneLength = this.byteLength - cloneOffset;
}
return new this.constructor(this.file, this.byteOffset + cloneOffset, cloneLength);
return new this.constructor(this.file, this.byteOffset + cloneOffset, cloneLength)
.setMaxBufferSize(this.bufferSize);
}
}

0 comments on commit 1fad66b

Please sign in to comment.