Skip to content

Commit

Permalink
reset content after calling "compressToBuffer"
Browse files Browse the repository at this point in the history
  • Loading branch information
5saviahv committed Jun 16, 2024
1 parent 50152d6 commit 56f3aae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions zipFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {
}
mh.copy(outBuffer, dindex);

// Since we update entry and main header offsets,
// they are no longer valid and we have to reset content
// (Issue 64)

inBuffer = outBuffer;
loadedEntries = false;

return outBuffer;
},

Expand Down Expand Up @@ -371,6 +378,13 @@ module.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {

mh.copy(outBuffer, dindex); // write main header

// Since we update entry and main header offsets, they are no
// longer valid and we have to reset content using our new buffer
// (Issue 64)

inBuffer = outBuffer;
loadedEntries = false;

onSuccess(outBuffer);
}
};
Expand Down

0 comments on commit 56f3aae

Please sign in to comment.