This repository was archived by the owner on Apr 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,6 @@ const toPathComponents = (path = '') => {
113113 // split on / unless escaped with \
114114 return ( path
115115 . trim ( )
116- . match ( / ( [ ^ \\ \] [ ^ / ] | \\ \/ ) + / g) || [ ] )
116+ . match ( / ( [ ^ \\ ^ / ] | \\ \/ ) + / g) || [ ] )
117117 . filter ( Boolean )
118118}
Original file line number Diff line number Diff line change @@ -257,6 +257,34 @@ describe('exporter', () => {
257257 )
258258 } )
259259
260+ it ( 'small file in a directory with an square brackets in the title' , ( done ) => {
261+ const fileName = `small-[bar]-file-${ Math . random ( ) } .txt`
262+ const filePath = `/foo/${ fileName } `
263+
264+ pull (
265+ pull . values ( [ {
266+ path : filePath ,
267+ content : pull . values ( [ smallFile ] )
268+ } ] ) ,
269+ importer ( ipld ) ,
270+ pull . collect ( ( err , files ) => {
271+ expect ( err ) . to . not . exist ( )
272+
273+ const path = `/ipfs/${ new CID ( files [ 1 ] . multihash ) . toBaseEncodedString ( ) } /${ fileName } `
274+
275+ pull (
276+ exporter ( path , ipld ) ,
277+ pull . collect ( ( err , files ) => {
278+ expect ( err ) . to . not . exist ( )
279+ expect ( files . length ) . to . equal ( 1 )
280+ expect ( files [ 0 ] . path ) . to . equal ( fileName )
281+ done ( )
282+ } )
283+ )
284+ } )
285+ )
286+ } )
287+
260288 it ( 'exports a chunk of a file with no links' , ( done ) => {
261289 const offset = 0
262290 const length = 5
You can’t perform that action at this time.
0 commit comments