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

Commit

Permalink
fix: don't expect ipfs to preserve a leading slash (#440)
Browse files Browse the repository at this point in the history
Go-ipfs now normalizes paths before adding files. This will:

* remove any leading slashes.
* remove any `/./` components.
* normalize any `/../` components.

That breaks this test which assumes that paths are returned _exactly_ as
specified.
  • Loading branch information
Stebalien authored and Alan Shaw committed Mar 13, 2019
1 parent d3dbd6f commit d3ad40b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/miscellaneous/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = (createCommon, options) => {

// Test resolve turns /ipfs/QmRootHash/path/to/file into /ipfs/QmFileHash
it('should resolve an IPFS path link', (done) => {
const path = '/path/to/testfile.txt'
const path = 'path/to/testfile.txt'
const content = loadFixture('test/fixtures/testfile.txt', 'interface-ipfs-core')

ipfs.add([{ path, content }], { wrapWithDirectory: true }, (err, res) => {
Expand All @@ -80,7 +80,7 @@ module.exports = (createCommon, options) => {
const rootHash = res.find(r => r.path === '').hash
const fileHash = res.find(r => r.path === path).hash

ipfs.resolve(`/ipfs/${rootHash}${path}`, (err, path) => {
ipfs.resolve(`/ipfs/${rootHash}/${path}`, (err, path) => {
expect(err).to.not.exist()
expect(path).to.equal(`/ipfs/${fileHash}`)
done()
Expand Down

0 comments on commit d3ad40b

Please sign in to comment.