kubo icon indicating copy to clipboard operation
kubo copied to clipboard

Add basic UnixFS sanity check to 'ipfs files cp'

Open lidel opened this issue 1 year ago • 1 comments

https://github.com/ipfs/kubo/issues/7999, https://github.com/ipfs/kubo/issues/8144, https://github.com/ipfs/kubo/issues/7172 still hunts us https://github.com/ipfs/ipfs-webui/issues/2205.

I think we should make ipfs files cp /ipfs/cid /mfs-destination at least check the root cid, and error if it is not a valid UnixFS node or has codec other than raw or dag-pb.

This way it is less likely people import non-UnixFS to MFS (majority of time, it will be root cid at fault). This would fix both CLI and ipfs-webui.

ps. while we are at this, we should also add --force mentioned in https://github.com/ipfs/kubo/issues/2074 (we already have it for rm, but not cp)

lidel avatar Feb 05 '24 16:02 lidel

When people attempt to add content that is not unixfs to MFS, should we prompt users to re-encode the data as unix-fs? I feel like the majority of webui users are unaware what type of content CIDs they're passing around is, and likely just want to add it to webui/desktop. The easier we make that, the happier they would be.

SgtPooki avatar Feb 05 '24 19:02 SgtPooki