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.get() with CIDv1 does not fetch content #2696

@AuHau

Description

@AuHau
  • Version: 0.40.0
  • Platform: macos
  • Subsystem:

Type: Bug

Severity: High

Description:

Retrieving CIDv1 returns type: dir and no content.

Steps to reproduce the error:

  it('js-ipfs should work', async () => {
    const cids = await ipfs.add(Buffer.from('hello world'), { cidVersion: 1 })
    console.log('All CIDs: ', cids)

    const result = await ipfs.get(cids[cids.length - 1].hash)
    console.log(result)

    const fetchedFromIpfs = result[0]
    expect(fetchedFromIpfs.content && fetchedFromIpfs.content.toString()).to.equal('hello world')
  })

Output of the former test:

All CIDs:  [
  {
    path: 'bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e',
    hash: 'bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e',
    size: 11
  }
]
[
  {
    hash: 'bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e',
    path: 'bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e',
    name: 'bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e',
    depth: 1,
    size: 0,
    type: 'dir'
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/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