-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add multibyte-encoded comment with byte length instead of character l…
…ength
- Loading branch information
1 parent
9d2eb0b
commit 1a334b2
Showing
5 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { expect } = require("chai"); | ||
const Utils = require("../../util"); | ||
const AdmZip = require("../../adm-zip"); | ||
const path = require("path"); | ||
|
||
describe('adm-zip', () => { | ||
it('adds multibyte ZIP comment in UTF-8 with appropriate byte', () => { | ||
const zip = new AdmZip(); | ||
zip.addLocalFile( | ||
path.join(__dirname, "./じっぷ/じっぷ.txt") | ||
); | ||
zip.addZipComment("じっぷ"); | ||
const willSend = zip.toBuffer(); | ||
const end = willSend.slice( | ||
willSend.lastIndexOf(Utils.Constants.ENDSIG) | ||
); | ||
const commentLength = end.readInt16LE(Utils.Constants.ENDCOM, 2); | ||
expect(commentLength).to.eq(9); | ||
const expected = Buffer.from("じっぷ"); | ||
const actual = end.slice(Utils.Constants.ENDCOM + 2); | ||
expect(actual).to.include(expected); | ||
expect(expected).to.include(actual); | ||
}); | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
じっぷ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters