Infer `ipfs add` flags from CID... automatically?

There are times when an IPFS CID goes dark, but you get what you are sure is the same file from elsewhere – this happens on libgen CIDs (cough cough), for example. When you want to add the file back, however, you find that the CID is different from the provided one because someone’s been using cool new flags. Now what?

You could do the flag inferrence manually: you only need the CID of the head node and one of the pieces to assemble the flag in most cases. If they are both online, you can use the webui’s Inspector, since it provides a “CID Info” field:

  • Get the hash algo from the head node CID. Get the blocksize from the node’s data. (If it’s a “smart” chunker? Well, try your luck.)
  • Get whether the leaves are raw from a CID of any of the data nodes. (It’s fine to have it “gone” since we are not using the data, but you don’t get to use the inspector.)

The thing is, it’s just burdensome to do this stuff. I want tool script that does it automagically, but in the meantime I am not sure where I should file the feature request to.

It’s a problem for sure, that’s why it’s not recommended to change the defaults settings.

GitHub - ipfs/go-ipfs: IPFS implementation in Go try here for new features