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

ipfs.files.add with {cidVersion: 1} returns CID of an empty file #1518

Closed
lidel opened this issue Aug 19, 2018 · 0 comments · Fixed by ipfs-inactive/js-ipfs-unixfs-engine#227 or #1523
Assignees
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up

Comments

@lidel
Copy link
Member

lidel commented Aug 19, 2018

This was originally found as a part of #1440 and ipfs/js-ipfs-http-response#9

  • Version: js-ipfs 0.31.6
  • Platform: Node
  • Subsystem:

Type: Bug

Severity: High

Description:

For some inputs ipfs.files.add with {cidVersion: 1} returns a CIDv1 of an empty file, instead of CID for the actual input buffer.

The problem does not occur if {cidVersion: 0} is used.

Steps to reproduce the error:

I attach test case that illustrates the issue: js-ipfs-add-cidv1-bug-repro.zip

To run it: yarn && yarn test (or npm install && npm test)

@alanshaw alanshaw added kind/bug A bug in existing code (including security flaws) exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue status/ready Ready to be worked P1 High: Likely tackled by core team if no one steps up labels Aug 20, 2018
@alanshaw alanshaw self-assigned this Aug 21, 2018
alanshaw added a commit to tableflip/js-ipfs-unixfs-engine that referenced this issue Aug 21, 2018
Using CID version 1 causes the raw leaves option to become `true` unless specified. The builder reducer was not expecting a raw leaf to be returned by ipld.get so was creating file nodes with empty data.

fixes ipfs/js-ipfs#1518

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
@ghost ghost added status/in-progress In progress and removed status/ready Ready to be worked labels Aug 21, 2018
@ghost ghost removed the status/in-progress In progress label Aug 21, 2018
lidel added a commit to lidel/js-ipfs-http-response that referenced this issue Sep 13, 2018
Context: ipfs/js-ipfs#1518

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up
Projects
None yet
2 participants