diff --git a/io/dagreader.go b/io/dagreader.go index 374b50916..f752b9c4a 100644 --- a/io/dagreader.go +++ b/io/dagreader.go @@ -195,6 +195,17 @@ func (dr *dagReader) CtxReadFull(ctx context.Context, out []byte) (n int, err er // Output buffer full, no need to keep traversing the DAG, // signal the `Walker` to pause the iteration. dr.dagWalker.Pause() + + } else if len(node.Links()) > 0 { + if len(node.Links()[0].Name) != 0 { + // This indicates that the node contains only named links, + // because empty string links always come before named ones. + // Incidentally, this means that the node's data is contained within + // its data attribute, which has already been read at this point. + // Therefore, we return an EOF signal. + + return ipld.EndOfDag + } } return nil