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

Commit

Permalink
chore: update dep version and ignore interop test for raw leaves (#2747)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Files that fit into one block imported with either `--cid-version=1`
or `--raw-leaves=true` previously returned a CID that resolved to
a raw node (e.g. a buffer). Returned CIDs now resolve to a `dag-pb`
node that contains a UnixFS entry. This is to allow setting metadata
on small files with CIDv1.
  • Loading branch information
achingbrain authored Mar 1, 2020
1 parent 866360a commit 6376cec
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
3 changes: 0 additions & 3 deletions examples/test-ipfs-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"bin": {
"test-ipfs-example": "./test.js"
},
"scripts": {
"test": "node ./test.js"
},
"license": "MIT",
"dependencies": {
"chromedriver": "^79.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dirty-chai": "^2.0.1",
"hat": "0.0.3",
"ipfs-block": "^0.8.1",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs": "^1.0.0",
"ipfs-utils": "^0.7.2",
"ipld-dag-cbor": "^0.15.1",
"ipld-dag-pb": "^0.18.2",
Expand Down
12 changes: 12 additions & 0 deletions packages/interface-ipfs-core/src/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,5 +532,17 @@ module.exports = (common, options) => {
it('should not add from an invalid url', () => {
return expect(all(ipfs.add(urlSource('123http://invalid')))).to.eventually.be.rejected()
})

it('should override raw leaves when file is smaller than one block', async () => {
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
cidVersion: 1,
rawLeaves: true
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
expect(files[0].cid.codec).to.equal('dag-pb')
expect(files[0].size).to.equal(11)
})
})
}
4 changes: 4 additions & 0 deletions packages/ipfs-http-client/test/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe('interface-ipfs-core tests', () => {
{
name: 'should ls with metadata',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should override raw leaves when file is smaller than one block',
reason: 'TODO not implemented in go-ipfs yet https://github.com/ipfs/go-ipfs/issues/6940'
}
]
})
Expand Down
6 changes: 3 additions & 3 deletions packages/ipfs-mfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"hamt-sharding": "^1.0.0",
"interface-datastore": "^0.8.0",
"ipfs-multipart": "^0.3.0",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs-exporter": "^0.41.0",
"ipfs-unixfs-importer": "^0.44.0",
"ipfs-unixfs": "^1.0.0",
"ipfs-unixfs-exporter": "^1.0.0",
"ipfs-unixfs-importer": "^1.0.0",
"ipfs-utils": "^0.7.0",
"ipld-dag-pb": "^0.18.2",
"it-all": "^1.0.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
"ipfs-mfs": "^1.0.0",
"ipfs-multipart": "^0.3.0",
"ipfs-repo": "^0.30.1",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs-exporter": "^0.41.0",
"ipfs-unixfs-importer": "^0.44.0",
"ipfs-unixfs": "^1.0.0",
"ipfs-unixfs-exporter": "^1.0.0",
"ipfs-unixfs-importer": "^1.0.0",
"ipfs-utils": "^0.7.2",
"ipld": "^0.25.0",
"ipld-bitcoin": "^0.3.0",
Expand Down Expand Up @@ -182,7 +182,7 @@
"go-ipfs-dep": "0.4.23-3",
"hat": "0.0.3",
"interface-ipfs-core": "^0.132.0",
"ipfs-interop": "^1.0.0",
"ipfs-interop": "github:ipfs/interop#disable-small-file-with-raw-leaves-test",
"ipfsd-ctl": "^3.0.0",
"it-first": "^1.0.1",
"ncp": "^2.0.0",
Expand Down
11 changes: 0 additions & 11 deletions packages/ipfs/test/core/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ describe('files', function () {
cidVersion: 1
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafkreifojmzibzlof6xyh5auu3r5vpu5l67brf3fitaf73isdlglqw2t7q')
expect(files[0].size).to.equal(3)
})

it('should add a file with a v1 CID and not raw leaves', async () => {
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
cidVersion: 1,
rawLeaves: false
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
expect(files[0].size).to.equal(11)
Expand Down

0 comments on commit 6376cec

Please sign in to comment.