Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
last cr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Nov 11, 2016
1 parent 19589ca commit 67fbc0f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"hapi": "^15.2.0",
"idb-pull-blob-store": "^0.5.1",
"ipfs-api": "^11.1.0",
"ipfs-bitswap": "^0.8.0",
"ipfs-bitswap": "^0.8.1",
"ipfs-block": "^0.5.0",
"ipfs-block-service": "^0.7.0",
"ipfs-multipart": "^0.1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/cli/commands/object/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ module.exports = {
(cb) => utils.getIPFS(cb),
(ipfs, cb) => ipfs.object.get(argv.key, {enc: 'base58'}, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
throw err
}

res.Data = res.Data ? res.Data.toString() : ''
console.log(JSON.stringify(res))
nodeJson.Data = nodeJson.Data ? nodeJson.Data.toString() : ''
console.log(JSON.stringify(nodeJson))
})
}
}
1 change: 1 addition & 0 deletions src/core/components/init-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = function addDefaultAssets (self, log, callback) {
content: file(element)
}
}),
// Filter out directories, which are undefined from above
pull.filter(Boolean),
importer(self._ipldResolver),
pull.through((el) => {
Expand Down
38 changes: 19 additions & 19 deletions src/http-api/resources/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports.new = (request, reply) => {
waterfall([
(cb) => ipfs.object.new(cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)
return reply({
Expand All @@ -46,7 +46,7 @@ exports.new = (request, reply) => {
}).code(500)
}

return reply(res)
return reply(nodeJson)
})
}

Expand All @@ -63,7 +63,7 @@ exports.get = {
waterfall([
(cb) => ipfs.object.get(key, {enc}, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)
return reply({
Expand All @@ -72,8 +72,8 @@ exports.get = {
}).code(500)
}

res.Data = res.Data ? res.Data.toString() : ''
return reply(res)
nodeJson.Data = nodeJson.Data ? nodeJson.Data.toString() : ''
return reply(nodeJson)
})
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ exports.put = {
parallel([
(cb) => ipfs.object.put(dagNode, cb),
(cb) => dagNode.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)
return reply({
Expand All @@ -165,7 +165,7 @@ exports.put = {
}).code(500)
}

return reply(res[1])
return reply(nodeJson[1])
})
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ exports.links = {
waterfall([
(cb) => ipfs.object.get(key, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)
return reply({
Expand All @@ -236,8 +236,8 @@ exports.links = {
}

return reply({
Hash: res.Hash,
Links: res.Links
Hash: nodeJson.Hash,
Links: nodeJson.Links
})
})
}
Expand Down Expand Up @@ -295,7 +295,7 @@ exports.patchAppendData = {
waterfall([
(cb) => ipfs.object.patch.appendData(key, data, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)

Expand All @@ -305,7 +305,7 @@ exports.patchAppendData = {
}).code(500)
}

return reply(res)
return reply(nodeJson)
})
}
}
Expand All @@ -323,7 +323,7 @@ exports.patchSetData = {
waterfall([
(cb) => ipfs.object.patch.setData(key, data, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)

Expand All @@ -334,8 +334,8 @@ exports.patchSetData = {
}

return reply({
Hash: res.Hash,
Links: res.Links
Hash: nodeJson.Hash,
Links: nodeJson.Links
})
})
}
Expand Down Expand Up @@ -403,7 +403,7 @@ exports.patchAddLink = {
},
(link, cb) => ipfs.object.patch.addLink(root, link, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)
return reply({
Expand All @@ -412,7 +412,7 @@ exports.patchAddLink = {
}).code(500)
}

return reply(res)
return reply(nodeJson)
})
})
}
Expand Down Expand Up @@ -455,7 +455,7 @@ exports.patchRmLink = {
waterfall([
(cb) => ipfs.object.patch.rmLink(root, link, cb),
(node, cb) => node.toJSON(cb)
], (err, res) => {
], (err, nodeJson) => {
if (err) {
log.error(err)
return reply({
Expand All @@ -464,7 +464,7 @@ exports.patchRmLink = {
}).code(500)
}

return reply(res)
return reply(nodeJson)
})
}
}

0 comments on commit 67fbc0f

Please sign in to comment.