File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ var extractFull = require('../lib/extractFull');
55
66describe ( 'Method: `Zip.extractFull`' , function ( ) {
77
8- afterEach ( function ( ) { fs . removeSync ( '.tmp/test' ) ; } ) ;
8+ // afterEach(function () { fs.removeSync('.tmp/test'); });
99
1010 it ( 'should return an error on 7z error' , function ( done ) {
1111 extractFull ( 'test/nothere.7z' , '.tmp/test' )
@@ -54,5 +54,14 @@ describe('Method: `Zip.extractFull`', function () {
5454 done ( ) ;
5555 } ) ;
5656 } ) ;
57+
58+ it ( 'should work with spaces in both source and destination' , function ( done ) {
59+ fs . copySync ( 'test/zip.7z' , '.tmp/test/Folder From/Folder A/Folder B/Folder C/zip file.7z' ) ;
60+ extractFull ( '.tmp/test/Folder From/Folder A/Folder B/Folder C/zip file.7z' , '.tmp/test/Folder To/Folder D/Folder E/Folder F' )
61+ . then ( function ( ) {
62+ expect ( fs . existsSync ( '.tmp/test/Folder To/Folder D/Folder E/Folder F/zip' ) ) . to . be . eql ( true ) ;
63+ done ( ) ;
64+ } ) ;
65+ } ) ;
5766
5867} ) ;
Original file line number Diff line number Diff line change 22var os = require ( 'os' ) ;
33var spawn = require ( 'win-spawn' ) ;
44var when = require ( 'when' ) ;
5+ var path = require ( 'path' ) ;
56
67/**
78 * @promise Run
@@ -37,11 +38,19 @@ module.exports = function (command) {
3738 }
3839 } ;
3940
40- // Run the filter twice. By splicing the array in the function above the
41- // filter does not run on the item just after one that is being removed.
42- args . forEach ( filterSpaces ) ;
43- args . forEach ( filterSpaces ) ;
44-
41+ // Run the filter for each space. By splicing the array in the function
42+ // above the filter does not run on the item just after one that is being
43+ // removed.
44+ for ( var i = 0 ; i < args . length ; i ++ ) {
45+ args . forEach ( filterSpaces ) ;
46+ }
47+
48+ // Normalize pathes before passing them to 7-Zip.
49+ if ( args . length > 1 ) {
50+ args [ 1 ] = path . normalize ( args [ 1 ] ) ;
51+ args [ 2 ] = path . normalize ( args [ 2 ] ) ;
52+ }
53+
4554 // When an stdout is emitted, parse it. If an error is detected in the body
4655 // of the stdout create an new error with the 7-Zip error message as the
4756 // error's message. Otherwise progress with stdout message.
You can’t perform that action at this time.
0 commit comments