File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,10 @@ class Filesystem {
142142 followLinks = typeof followLinks === 'undefined' ? true : followLinks
143143 const info = this . getNode ( p )
144144
145+ if ( ! info ) {
146+ throw new Error ( `"${ p } " was not found in this archive` )
147+ }
148+
145149 // if followLinks is false we don't resolve symlinks
146150 if ( info . link && followLinks ) {
147151 return this . getFile ( info . link )
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ describe('command line interface', function () {
8383 await execAsar ( 'e test/input/extractthis-unpack.asar tmp/extractthis-unpack-cli/' )
8484 return compDirs ( 'tmp/extractthis-unpack-cli/' , 'test/expected/extractthis' )
8585 } )
86+ it ( 'should throw an error when trying to extract a file that doesn\'t exist in the archive' , async ( ) => {
87+ await assert . rejects ( execAsar ( 'ef test/input/extractthis.asar this-file-doesnt-exist.404' ) , / " ( .* ?) " w a s n o t f o u n d i n t h i s a r c h i v e / )
88+ } )
8689 it ( 'should create archive from directory with unpacked dirs' , async ( ) => {
8790 await execAsar ( 'p test/input/packthis/ tmp/packthis-unpack-dir-cli.asar --unpack-dir dir2 --exclude-hidden' )
8891 assert . ok ( fs . existsSync ( 'tmp/packthis-unpack-dir-cli.asar.unpacked/dir2/file2.png' ) )
You can’t perform that action at this time.
0 commit comments