This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +4
-7
lines changed 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ exports = module.exports = function HttpApi (repo) {
19
19
20
20
this . start = ( callback ) => {
21
21
if ( typeof repo === 'string' ) {
22
- console . log ( 'here' )
23
22
repo = new IPFSRepo ( repo , { stores : fsbs } )
24
23
}
25
24
Original file line number Diff line number Diff line change @@ -17,8 +17,7 @@ exports.add = {
17
17
18
18
const parser = multipart . reqParser ( request . payload )
19
19
20
- var file = false
21
- var written = 0
20
+ var filesSeen = 0
22
21
23
22
var serialize = ndjson . serialize ( )
24
23
// hapi doesn't permit object streams: http://hapijs.com/api#replyerr-result
@@ -31,11 +30,11 @@ exports.add = {
31
30
Name : file . path ,
32
31
Hash : bs58 . encode ( file . multihash ) . toString ( )
33
32
} )
34
- written ++
33
+ filesSeen ++
35
34
} )
36
35
37
36
fileAdder . on ( 'end' , ( ) => {
38
- if ( written === 0 && file ) {
37
+ if ( ! filesSeen ) {
39
38
return reply ( {
40
39
Message : 'Failed to add files' ,
41
40
Code : 0
@@ -53,12 +52,11 @@ exports.add = {
53
52
path : fileName ,
54
53
stream : fileStream
55
54
}
56
- file = true
57
55
fileAdder . write ( filePair )
58
56
} )
59
57
60
58
parser . on ( 'end' , ( ) => {
61
- if ( ! file ) {
59
+ if ( ! filesSeen ) {
62
60
return reply ( "File argument 'data' is required" ) . code ( 400 ) . takeover ( )
63
61
}
64
62
fileAdder . end ( )
You can’t perform that action at this time.
0 commit comments