ipfs / ipfs/boxo

ipld/unixfs: Dagreader ignores internal data node when links are present

Open
#390 2 comments 1 reaction 0 assignees View on GitHub
kind/bug need/analysis need/community-input P3
Dominant language
Go
Stars
316
Forks
163
Avg merge
4d 12h
Merged PRs (30d)
8

Description

Hello!

I'm currently studying a use case for go-ipfs in which a file node contains links to other versions of itself.
This all works well until the root file becomes small enough to fit inside the root's data node. Then, accessing the file through `ipfs cat` or the gateway skips the data node and goes on to read from the child nodes.
After investigating the bug, I found that it originated from `go-unixfs`, and especially the dagreader.
More precisely, https://github.com/ipfs/go-unixfs/blob/68c015a6f317ed5e21a4870f7c423a4b38b90a96/io/dagreader.go#L175-L179

I already have a fix for this if there is any interest, although it relies on the empirical assumption that we should stop descending through the DAG when we read a node that has *named* links (`len(node.Links()[0].Name) != 0`).

This would also close https://github.com/ipfs/go-ipfs/issues/7190 , which I opened a month ago.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.