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

ipfs.files.add with {cidVersion: 1} returns valid hash with undefined size #1585

Closed
@lidel

Description

@lidel

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

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

Type: Bug

Severity: High

Description:

For some inputs ipfs.files.add with {cidVersion: 1} returns valid CID however size field is undefined. The problem does not occur if {cidVersion: 0} is used.

Result of ipfs.files.add (CIDv0)
{ path: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',
    hash: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',
    size: 20 }
Result of ipfs.files.add (CIDv1)
{ path: 'zb2rhdTDKmCQD2a9x2TfLR61M3s7RmESzwV5mqgnakXQbm5gp',
    hash: 'zb2rhdTDKmCQD2a9x2TfLR61M3s7RmESzwV5mqgnakXQbm5gp',
    size: undefined }

Steps to reproduce the error:

Did not look into details, but I attach test case that illustrates the issue: js-ipfs-add-cidv1-missing-size-bug-repro.zip.

To run it: yarn && yarn test (or npm install && npm test).
Hope this helps.

Metadata

Metadata

Assignees

Labels

P2Medium: Good to have, but can wait until someone steps upexp/noviceSomeone with a little familiarity can pick upkind/bugA bug in existing code (including security flaws)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions