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

Commit

Permalink
version update includes several fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Apr 25, 2016
1 parent 45c67e4 commit 1fbb42f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"homepage": "https://github.com/ipfs/js-ipfs#readme",
"devDependencies": {
"aegir": "^2.1.1",
"aegir": "^2.1.2",
"async": "^1.5.2",
"buffer-loader": "0.0.1",
"chai": "^3.5.0",
Expand Down Expand Up @@ -70,7 +70,7 @@
"ipfs-multipart": "^0.1.0",
"ipfs-repo": "^0.6.1",
"joi": "^8.0.2",
"libp2p-ipfs": "^0.3.2",
"libp2p-ipfs": "^0.3.3",
"lodash.get": "^4.2.1",
"lodash.set": "^4.0.0",
"multiaddr": "^1.3.0",
Expand Down
12 changes: 9 additions & 3 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ function IPFS (repo) {
patch: {
appendData: (multihash, data, callback) => {
this.object.get(multihash, (err, obj) => {
if (err) { return callback(err) }
if (err) {
return callback(err)
}
obj.data = Buffer.concat([obj.data, data])
dagS.add(obj, (err) => {
if (err) {
Expand All @@ -217,7 +219,9 @@ function IPFS (repo) {
},
addLink: (multihash, link, callback) => {
this.object.get(multihash, (err, obj) => {
if (err) { return callback(err) }
if (err) {
return callback(err)
}
obj.addRawLink(link)
dagS.add(obj, (err) => {
if (err) {
Expand All @@ -229,7 +233,9 @@ function IPFS (repo) {
},
rmLink: (multihash, linkRef, callback) => {
this.object.get(multihash, (err, obj) => {
if (err) { return callback(err) }
if (err) {
return callback(err)
}
obj.links = obj.links.filter((link) => {
// filter by name when linkRef is a string, or by hash otherwise
if (typeof linkRef === 'string') {
Expand Down
13 changes: 10 additions & 3 deletions src/http-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,15 @@ exports = module.exports = function HttpApi (repo) {
this.stop = (callback) => {
const repoPath = this.ipfs.repo.path()
fs.unlinkSync(path.join(repoPath, 'api'))
this.ipfs.libp2p.stop(() => {
this.server.stop(callback)
})
let counter = 0

this.server.stop(closed)
this.ipfs.libp2p.stop(closed)

function closed () {
if (++counter === 2) {
callback()
}
}
}
}
1 change: 0 additions & 1 deletion test/http-api-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('http api', () => {
after((done) => {
api.stop((err) => {
expect(err).to.not.exist

clean(repoTests)
done()
})
Expand Down
2 changes: 1 addition & 1 deletion test/http-api-tests/test-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports = (httpAPI) => {
it('updates value for request with both args and JSON flag with valid JSON argument', (done) => {
api.inject({
method: 'POST',
url: '/api/v0/config?arg=Datastore.Path&arg={\"kitten\": true}&json'
url: '/api/v0/config?arg=Datastore.Path&arg={"kitten": true}&json'
}, (res) => {
expect(res.statusCode).to.equal(200)
expect(res.result.Key).to.equal('Datastore.Path')
Expand Down

0 comments on commit 1fbb42f

Please sign in to comment.