From d610acbe36b5a915be3d9bf1cca493b9ba93e8cf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Aug 2016 11:03:29 -0700 Subject: [PATCH 1/4] Add multibyte character path specs --- test/api-spec.coffee | 5 +++++ test/cli-spec.coffee | 10 ++++++++++ test/expected/packthis-unicode-path-filelist.txt | 3 +++ test/expected/packthis-unicode-path.asar | Bin 0 -> 124 bytes test/input/packthis-unicode-path/dir1/file1.txt | 0 test/input/packthis-unicode-path/dir1/女の子.txt | 0 6 files changed, 18 insertions(+) create mode 100644 test/expected/packthis-unicode-path-filelist.txt create mode 100644 test/expected/packthis-unicode-path.asar create mode 100644 test/input/packthis-unicode-path/dir1/file1.txt create mode 100644 test/input/packthis-unicode-path/dir1/女の子.txt diff --git a/test/api-spec.coffee b/test/api-spec.coffee index 4ecd8d9..8d6d9f1 100644 --- a/test/api-spec.coffee +++ b/test/api-spec.coffee @@ -60,4 +60,9 @@ describe 'api', -> asar.extractAll 'test/input/extractthis-unpack-dir.asar', 'tmp/extractthis-unpack-dir-api/' compDirs 'tmp/extractthis-unpack-dir-api/', 'test/expected/extractthis', done return + it 'should handle multibyte characters in paths', (done) -> + asar.createPackage 'test/input/packthis-unicode-path/', 'tmp/packthis-unicode-path.asar', (error) -> + done compFiles 'tmp/packthis-unicode-path.asar', 'test/expected/packthis-unicode-path.asar' + return + return return diff --git a/test/cli-spec.coffee b/test/cli-spec.coffee index 2a48158..b31f629 100644 --- a/test/cli-spec.coffee +++ b/test/cli-spec.coffee @@ -43,6 +43,16 @@ describe 'command line interface', -> done assert.equal actual, expected return return + it 'should list files/dirs with multibyte characters in path', (done) -> + exec 'node bin/asar l test/expected/packthis-unicode-path.asar', (error, stdout, stderr) -> + actual = stdout + expected = fs.readFileSync('test/expected/packthis-unicode-path-filelist.txt', 'utf8') + '\n' + # on windows replace slashes with backslashes and crlf with lf + if os.platform() is 'win32' + expected = expected.replace(/\//g, '\\').replace(/\r\n/g, '\n') + done assert.equal actual, expected + return + return # we need a way to set a path to extract to first, otherwise we pollute our project dir # or we fake it by setting our cwd, but I don't like that ### diff --git a/test/expected/packthis-unicode-path-filelist.txt b/test/expected/packthis-unicode-path-filelist.txt new file mode 100644 index 0000000..8d62174 --- /dev/null +++ b/test/expected/packthis-unicode-path-filelist.txt @@ -0,0 +1,3 @@ +/dir1 +/dir1/file1.txt +/dir1/女の子.txt \ No newline at end of file diff --git a/test/expected/packthis-unicode-path.asar b/test/expected/packthis-unicode-path.asar new file mode 100644 index 0000000000000000000000000000000000000000..67f720fcf3ed85c16dc89b1a28d42f067777719f GIT binary patch literal 124 zcmZQ!U|=W#;sPMf0^(|=w9K5;VkN6;rIgGfLl6xY05J^pN-9b~qQ#k2sY+G`I!gIz gX~n5PAteK)S{ Date: Mon, 29 Aug 2016 11:06:55 -0700 Subject: [PATCH 2/4] :arrow_up: chromium-pickle-js@0.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b71a711..111fd9d 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "clean": "grunt clean" }, "dependencies": { - "chromium-pickle-js": "^0.1.0", + "chromium-pickle-js": "^0.2.0", "commander": "^2.9.0", "cuint": "^0.2.1", "glob": "^6.0.4", From 16bbd46a9a6d52eecc27c4067c3d0133b3d2bdb7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Aug 2016 11:07:50 -0700 Subject: [PATCH 3/4] Add multibyte path support to changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18828aa..d03cbd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changes By Version +## Unreleased + +### Fixed + +- Multibyte characters in paths are now supported (#86) + ## 0.12.2 - 2016-08-22 ### Fixed From d66f720441a2b8538cb8328a5aeca999c5e6c2a5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Aug 2016 11:12:35 -0700 Subject: [PATCH 4/4] Add text for extracting file with multibyte characters in path --- test/api-spec.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/api-spec.coffee b/test/api-spec.coffee index 8d6d9f1..13378f4 100644 --- a/test/api-spec.coffee +++ b/test/api-spec.coffee @@ -65,4 +65,10 @@ describe 'api', -> done compFiles 'tmp/packthis-unicode-path.asar', 'test/expected/packthis-unicode-path.asar' return return + it 'should extract a text file from archive with multibyte characters in path', -> + actual = asar.extractFile('test/expected/packthis-unicode-path.asar', 'dir1/女の子.txt').toString 'utf8' + expected = fs.readFileSync 'test/input/packthis-unicode-path/dir1/女の子.txt', 'utf8' + # on windows replace crlf with lf + expected = expected.replace /\r\n/g, '\n' if os.platform() is 'win32' + assert.equal actual, expected return