This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
fixtures/odd-name-[v0]/odd name [v1] Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -206,12 +206,20 @@ module.exports = {
206206 }
207207 const ipfs = argv . ipfs
208208
209- let list = [ ]
209+ let list
210210 waterfall ( [
211- ( next ) => glob ( path . join ( inPath , '/**/*' ) , next ) ,
211+ ( next ) => {
212+ if ( fs . statSync ( inPath ) . isDirectory ( ) ) {
213+ return glob ( '**/*' , { cwd : inPath } , next )
214+ }
215+ next ( null , [ ] )
216+ } ,
212217 ( globResult , next ) => {
213- list = globResult . length === 0 ? [ inPath ] : globResult
214-
218+ if ( globResult . length === 0 ) {
219+ list = [ inPath ]
220+ } else {
221+ list = globResult . map ( ( f ) => inPath + '/' + f )
222+ }
215223 getTotalBytes ( inPath , argv . recursive , next )
216224 } ,
217225 ( totalBytes , next ) => {
Original file line number Diff line number Diff line change @@ -154,6 +154,20 @@ describe('files', () => runOnAndOff((thing) => {
154154 } )
155155 } )
156156
157+ it ( 'add directory with odd name' , function ( ) {
158+ this . timeout ( 30 * 1000 )
159+ const expected = [
160+ 'added QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o odd-name-[v0]/odd name [v1]/hello' ,
161+ 'added QmYRMUVULBfj7WrdPESnwnyZmtayN6Sdrwh1nKcQ9QgQeZ odd-name-[v0]/odd name [v1]' ,
162+ 'added QmXJGoo27bg7ExNAtr9vRcivxDwcfHtkxatGno9HrUdR16 odd-name-[v0]'
163+ ]
164+
165+ return ipfs ( 'files add -r test/fixtures/odd-name-[v0]' )
166+ . then ( ( out ) => {
167+ expect ( out ) . to . eql ( expected . join ( '\n' ) + '\n' )
168+ } )
169+ } )
170+
157171 it ( 'add and wrap with a directory' , function ( ) {
158172 this . timeout ( 30 * 1000 )
159173
Original file line number Diff line number Diff line change 1+ hello world
You can’t perform that action at this time.
0 commit comments