From fecf7811b12750b75f308936e5140cdb150f45e7 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 18 Feb 2019 19:58:10 -0800 Subject: [PATCH] fix: don't expect ipfs to preserve a leading slash 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. --- src/miscellaneous/resolve.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miscellaneous/resolve.js b/src/miscellaneous/resolve.js index e613ef072..282140dbe 100644 --- a/src/miscellaneous/resolve.js +++ b/src/miscellaneous/resolve.js @@ -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) => { @@ -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()