This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +23
-1
lines changed
ipfs-http-server/src/api/resources
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,28 @@ module.exports = (common, options) => {
171
171
expect ( root . cid . toString ( ) ) . to . equal ( fixtures . directory . cid )
172
172
} )
173
173
174
+ it ( 'should receive progress path as empty string when adding content without paths' , async function ( ) {
175
+ const content = ( name ) => fixtures . directory . files [ name ]
176
+ const progressSizes = { }
177
+
178
+ const dirs = [
179
+ content ( 'pp.txt' ) ,
180
+ content ( 'holmes.txt' ) ,
181
+ content ( 'jungle.txt' )
182
+ ]
183
+
184
+ const total = {
185
+ '' : dirs . reduce ( ( acc , curr ) => acc + curr . length , 0 )
186
+ }
187
+
188
+ const handler = ( bytes , path ) => {
189
+ progressSizes [ path ] = bytes
190
+ }
191
+
192
+ await drain ( ipfs . addAll ( dirs , { progress : handler } ) )
193
+ expect ( progressSizes ) . to . deep . equal ( total )
194
+ } )
195
+
174
196
it ( 'should receive file name from progress event' , async ( ) => {
175
197
const receivedNames = [ ]
176
198
function handler ( p , name ) {
Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ exports.add = {
260
260
multipart ( request ) ,
261
261
async function * ( source ) {
262
262
for await ( const entry of source ) {
263
- currentFileName = entry . name || 'unknown '
263
+ currentFileName = entry . name || ''
264
264
265
265
if ( entry . type === 'file' ) {
266
266
filesParsed = true
You can’t perform that action at this time.
0 commit comments