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

fix: regression caused by 322b756 #591

Merged
merged 1 commit into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@
"url": "https://github.com/ipfs/js-ipfs-api/issues"
},
"homepage": "https://github.com/ipfs/js-ipfs-api"
}
}
10 changes: 2 additions & 8 deletions src/files/create-add-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ module.exports = (send) => {

ds.end = () => {
add(tuples, options, (err, res) => {
if (err) {
return ds.emit('error', err)
}

res.forEach((tuple) => {
ds.push(tuple)
})

if (err) { return ds.emit('error', err) }
res.forEach((tuple) => ds.push(tuple))
ds.push(null)
})
}
Expand Down
2 changes: 0 additions & 2 deletions src/object/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ module.exports = (send) => {
}

if (node.toJSON().multihash !== result.Hash) {
console.log(node.toJSON())
console.log(result)
return callback(new Error('multihashes do not match'))
}

Expand Down
11 changes: 6 additions & 5 deletions src/utils/get-files-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ const flatmap = require('flatmap')
const escape = require('glob-escape')

function headers (file) {
const name = encodeURIComponent(file.path) || ''
const header = {
'Content-Disposition': `file; filename="${name}"`
}
const name = file.path
? encodeURIComponent(file.path)
: ''

const header = { 'Content-Disposition': `file; filename="${name}"` }

if (file.dir || !file.content) {
header['Content-Type'] = 'application/x-directory'
Expand Down Expand Up @@ -49,7 +50,7 @@ function loadPaths (opts, file) {
const mg = new glob.sync.GlobSync(`${globEscapedDir}` + '**/*', {
follow: followSymlinks,
dot: opts.hidden,
ignore: (opts.ignore || []).map(function (ignoreGlob) {
ignore: (opts.ignore || []).map((ignoreGlob) => {
return globEscapedDir + ignoreGlob
})
})
Expand Down
3 changes: 2 additions & 1 deletion src/utils/request-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const request = require('./request')

function parseError (res, cb) {
const error = new Error(`Server responded with ${res.statusCode}`)

streamToJsonValue(res, (err, payload) => {
if (err) {
return cb(err)
Expand Down Expand Up @@ -61,8 +62,8 @@ function onRes (buffer, cb) {
}

function requestAPI (config, options, callback) {
options.qs = options.qs || {}
callback = once(callback)
options.qs = options.qs || {}

if (Array.isArray(options.files)) {
options.qs.recursive = true
Expand Down