-
Notifications
You must be signed in to change notification settings - Fork 13
Conversation
- feat: CID support, added resolver.cid - feat: basic support for HAMD sharded directory - not real support, we need ipfs.resolve for that - fix: return data from raw dag without resolv step License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
if (dagDataObj.type === 'directory' || dagDataObj.type === 'hamt-sharded-directory') { | ||
let isDirErr = new Error('This dag node is a directory') | ||
// store memo of last multihash so it can be used by directory | ||
isDirErr.cid = isDirErr.fileName = cid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backward compatibility: js-ipfs uses fileName
field, so we are keeping it here for now.
When ipfs-http-response
is released with these changes, will PR js-ipfs to switch from fileName
to cid
Context: ipfs/js-ipfs#1518 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
@vasco-santos I switched to latest release of js-ipfs (e320884), it includes the fix for broken tests when Tests pass locally and it is ready to merge. |
Thanks for this PR @lidel The CI is not happy and I tested it locally and I had the same tests failing 🤔 |
Indeed something is fishy, I'll look into this. |
Old CIDs were invalid as noted in: ipfs-inactive/js-ipfs-unixfs-engine#227 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
@vasco-santos check now, (I've finally found a moment to fix it: CIDs used in tests were invalid because I generated them with js-ipfs without fix from ipfs-inactive/js-ipfs-unixfs-engine#227 🤦♂️) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lidel for the complete PR and for a general improvement on documentation. Left just a few observations before merging this.
Meanwhile I will test this with js-ipfs
and service-worker-gateway
// console.log('CIDv1', filesAdded) | ||
const retrievedFile = filesAdded[0] | ||
expect(new CID(retrievedFile.hash)).to.deep.equal(new CID(file.cid)) | ||
// expect(retrievedFile.size, 'ipfs.files.add result size should not be smaller than input buffer').greaterThan(file.data.length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we receive the file size with CIDv1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope :) there is a bug and size is undefined
– i reported it in ipfs/js-ipfs#1585
It does not impact what this lib does, data is added correctly by js-ipfs, so I commented it out for now.
License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
@lidel Now the changes look good to me, but there are some problems with the tests. I cannot have the tests running again and they are failing in the before hook, while adding files. Do you know what the problem is? |
This PR is officially haunted 👻 I get the same issue locally as well 👀 I am quite sure it is related to ipfs-shipyard/is-ipfs#21 and changes in cids v0.5.4-v0.5.3, namely: It can be fixed in yarn via: + "resolutions": {
+ "cids": "^0.5.5"
+ },
|
cids@0.5.4 now uses class-is and checks for CIDs were failing because tests were using the old version. License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
Our Jenkins setup changed recently and `test` is ignored License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
b33a02e
to
17cf177
Compare
@vasco-santos I switched to latest ps. I had to add |
Nice @lidel Thanks for the PR! |
Closes #8, see it for details.
resolver.cid
(resolver.multihash
still works)ipfs.files.add
returns a CIDv1 of an empty file forpp.txt
andtestfile.txt