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

Commit 6376cec

Browse files
authored
chore: update dep version and ignore interop test for raw leaves (#2747)
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.
1 parent 866360a commit 6376cec

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

examples/test-ipfs-example/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"bin": {
77
"test-ipfs-example": "./test.js"
88
},
9-
"scripts": {
10-
"test": "node ./test.js"
11-
},
129
"license": "MIT",
1310
"dependencies": {
1411
"chromedriver": "^79.0.0",

packages/interface-ipfs-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"dirty-chai": "^2.0.1",
3939
"hat": "0.0.3",
4040
"ipfs-block": "^0.8.1",
41-
"ipfs-unixfs": "^0.3.0",
41+
"ipfs-unixfs": "^1.0.0",
4242
"ipfs-utils": "^0.7.2",
4343
"ipld-dag-cbor": "^0.15.1",
4444
"ipld-dag-pb": "^0.18.2",

packages/interface-ipfs-core/src/add.js

+12
Original file line numberDiff line numberDiff line change
@@ -532,5 +532,17 @@ module.exports = (common, options) => {
532532
it('should not add from an invalid url', () => {
533533
return expect(all(ipfs.add(urlSource('123http://invalid')))).to.eventually.be.rejected()
534534
})
535+
536+
it('should override raw leaves when file is smaller than one block', async () => {
537+
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
538+
cidVersion: 1,
539+
rawLeaves: true
540+
}))
541+
542+
expect(files.length).to.equal(1)
543+
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
544+
expect(files[0].cid.codec).to.equal('dag-pb')
545+
expect(files[0].size).to.equal(11)
546+
})
535547
})
536548
}

packages/ipfs-http-client/test/interface.spec.js

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ describe('interface-ipfs-core tests', () => {
4343
{
4444
name: 'should ls with metadata',
4545
reason: 'TODO not implemented in go-ipfs yet'
46+
},
47+
{
48+
name: 'should override raw leaves when file is smaller than one block',
49+
reason: 'TODO not implemented in go-ipfs yet https://github.com/ipfs/go-ipfs/issues/6940'
4650
}
4751
]
4852
})

packages/ipfs-mfs/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666
"hamt-sharding": "^1.0.0",
6767
"interface-datastore": "^0.8.0",
6868
"ipfs-multipart": "^0.3.0",
69-
"ipfs-unixfs": "^0.3.0",
70-
"ipfs-unixfs-exporter": "^0.41.0",
71-
"ipfs-unixfs-importer": "^0.44.0",
69+
"ipfs-unixfs": "^1.0.0",
70+
"ipfs-unixfs-exporter": "^1.0.0",
71+
"ipfs-unixfs-importer": "^1.0.0",
7272
"ipfs-utils": "^0.7.0",
7373
"ipld-dag-pb": "^0.18.2",
7474
"it-all": "^1.0.1",

packages/ipfs/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@
100100
"ipfs-mfs": "^1.0.0",
101101
"ipfs-multipart": "^0.3.0",
102102
"ipfs-repo": "^0.30.1",
103-
"ipfs-unixfs": "^0.3.0",
104-
"ipfs-unixfs-exporter": "^0.41.0",
105-
"ipfs-unixfs-importer": "^0.44.0",
103+
"ipfs-unixfs": "^1.0.0",
104+
"ipfs-unixfs-exporter": "^1.0.0",
105+
"ipfs-unixfs-importer": "^1.0.0",
106106
"ipfs-utils": "^0.7.2",
107107
"ipld": "^0.25.0",
108108
"ipld-bitcoin": "^0.3.0",
@@ -182,7 +182,7 @@
182182
"go-ipfs-dep": "0.4.23-3",
183183
"hat": "0.0.3",
184184
"interface-ipfs-core": "^0.132.0",
185-
"ipfs-interop": "^1.0.0",
185+
"ipfs-interop": "github:ipfs/interop#disable-small-file-with-raw-leaves-test",
186186
"ipfsd-ctl": "^3.0.0",
187187
"it-first": "^1.0.1",
188188
"ncp": "^2.0.0",

packages/ipfs/test/core/files.spec.js

-11
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ describe('files', function () {
3838
cidVersion: 1
3939
}))
4040

41-
expect(files.length).to.equal(1)
42-
expect(files[0].cid.toString()).to.equal('bafkreifojmzibzlof6xyh5auu3r5vpu5l67brf3fitaf73isdlglqw2t7q')
43-
expect(files[0].size).to.equal(3)
44-
})
45-
46-
it('should add a file with a v1 CID and not raw leaves', async () => {
47-
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
48-
cidVersion: 1,
49-
rawLeaves: false
50-
}))
51-
5241
expect(files.length).to.equal(1)
5342
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
5443
expect(files[0].size).to.equal(11)

0 commit comments

Comments
 (0)