Problem
When opening /ipfs/<CID>/sub/file.txt, open_ipfs fetches the entire CID as a flat byte blob via cache.fetch(), writes it to staging/<CID>, then tries to open staging/<CID>/sub/file.txt.
This only works if the staged content is a directory tree. But Kubo's cat API returns flat bytes (concatenated file content). For UnixFS directories, you need the get API which returns a tarball, then unpack it.
Current behavior: subpath requests on directory CIDs will return NoEntry because the nested path doesn't exist on disk after writing the flat blob. The integration tests pass because mock pinners return whatever bytes you give them.
Fix
For CIDs that are UnixFS directories:
- Use a
get-style API that preserves directory structure (e.g., Kubo's /api/v0/get)
- Unpack the returned tarball into the staging directory
- Then open the subpath from the unpacked tree
Alternatively, resolve subpaths at the IPFS layer: fetch <CID>/sub/file.txt directly rather than fetching the root CID and navigating locally.
Context
Found by adversarial review on #263. The Pinner::fetch trait method returns Vec<u8> which is fine for single files but doesn't preserve directory structure.
Severity
High — subpath access is a documented feature but doesn't work for real IPFS directories.
Problem
When opening
/ipfs/<CID>/sub/file.txt,open_ipfsfetches the entire CID as a flat byte blob viacache.fetch(), writes it tostaging/<CID>, then tries to openstaging/<CID>/sub/file.txt.This only works if the staged content is a directory tree. But Kubo's
catAPI returns flat bytes (concatenated file content). For UnixFS directories, you need thegetAPI which returns a tarball, then unpack it.Current behavior: subpath requests on directory CIDs will return
NoEntrybecause the nested path doesn't exist on disk after writing the flat blob. The integration tests pass because mock pinners return whatever bytes you give them.Fix
For CIDs that are UnixFS directories:
get-style API that preserves directory structure (e.g., Kubo's/api/v0/get)Alternatively, resolve subpaths at the IPFS layer: fetch
<CID>/sub/file.txtdirectly rather than fetching the root CID and navigating locally.Context
Found by adversarial review on #263. The
Pinner::fetchtrait method returnsVec<u8>which is fine for single files but doesn't preserve directory structure.Severity
High — subpath access is a documented feature but doesn't work for real IPFS directories.