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-core: dag.get does not return nested CID data #3957

Closed
@stephhuynh18

Description

@stephhuynh18

Version: ipfs-core 0.12.2

Severity:

High - The main functionality of the application does not work, API breakage, repo format breakage, etc.

Description:

We are currently upgrading to the latest versions of ipfs-related packages. We found that ipfs-core may have an issue with dag.get.

If we put JSON-like data on an IPFS node using dag.put, and this data contains a key that corresponds to a valid CID (nestedCID), when we get that data using dag.get and a path to that key, the nestedCID is returned instead of the data contained at the nestedCID.

  const regularContent = { test: '123' };
  const cid1 = await ipfs.dag.put(regularContent);
  const linkedContent = { link: cid1 };
  const cid2 = await ipfs.dag.put(linkedContent);

  const atPath = await ipfs.dag.get(cid2, { path: '/link' });
  // expected: { test: '123' }
  // received: CID(xxx)

This is not consistent with ipfs-core v0.7, where the data stored at the nestedCID is returned.

Is returning the nestedCID the desired behavior?

I also noticed that the nestedCID data is retrieved here:

value = await load(value)
. Nothing is done with the data as yield is not called with this data. If yield is called with this data, the data is returned.

Steps to reproduce the error:

This issue is demonstrated here: https://github.com/stephhuynh18/ipfs-dag-get-issue

CC @ukstv

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions