Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 8affcfe

Browse files
authored
fix: regression caused by 322b756 (#591)
1 parent 70c91b7 commit 8affcfe

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@
136136
"url": "https://github.com/ipfs/js-ipfs-api/issues"
137137
},
138138
"homepage": "https://github.com/ipfs/js-ipfs-api"
139-
}
139+
}

src/files/create-add-stream.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,8 @@ module.exports = (send) => {
2525

2626
ds.end = () => {
2727
add(tuples, options, (err, res) => {
28-
if (err) {
29-
return ds.emit('error', err)
30-
}
31-
32-
res.forEach((tuple) => {
33-
ds.push(tuple)
34-
})
35-
28+
if (err) { return ds.emit('error', err) }
29+
res.forEach((tuple) => ds.push(tuple))
3630
ds.push(null)
3731
})
3832
}

src/object/new.js

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ module.exports = (send) => {
3636
}
3737

3838
if (node.toJSON().multihash !== result.Hash) {
39-
console.log(node.toJSON())
40-
console.log(result)
4139
return callback(new Error('multihashes do not match'))
4240
}
4341

src/utils/get-files-stream.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ const flatmap = require('flatmap')
66
const escape = require('glob-escape')
77

88
function headers (file) {
9-
const name = encodeURIComponent(file.path) || ''
10-
const header = {
11-
'Content-Disposition': `file; filename="${name}"`
12-
}
9+
const name = file.path
10+
? encodeURIComponent(file.path)
11+
: ''
12+
13+
const header = { 'Content-Disposition': `file; filename="${name}"` }
1314

1415
if (file.dir || !file.content) {
1516
header['Content-Type'] = 'application/x-directory'
@@ -49,7 +50,7 @@ function loadPaths (opts, file) {
4950
const mg = new glob.sync.GlobSync(`${globEscapedDir}` + '**/*', {
5051
follow: followSymlinks,
5152
dot: opts.hidden,
52-
ignore: (opts.ignore || []).map(function (ignoreGlob) {
53+
ignore: (opts.ignore || []).map((ignoreGlob) => {
5354
return globEscapedDir + ignoreGlob
5455
})
5556
})

src/utils/request-api.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const request = require('./request')
1515

1616
function parseError (res, cb) {
1717
const error = new Error(`Server responded with ${res.statusCode}`)
18+
1819
streamToJsonValue(res, (err, payload) => {
1920
if (err) {
2021
return cb(err)
@@ -61,8 +62,8 @@ function onRes (buffer, cb) {
6162
}
6263

6364
function requestAPI (config, options, callback) {
64-
options.qs = options.qs || {}
6565
callback = once(callback)
66+
options.qs = options.qs || {}
6667

6768
if (Array.isArray(options.files)) {
6869
options.qs.recursive = true

0 commit comments

Comments
 (0)