is-ipfs icon indicating copy to clipboard operation
is-ipfs copied to clipboard

That `function isIpfs` conflates matching URI fragments and checking if the hash is a CID makes it less useful

Open TimDaub opened this issue 3 years ago • 0 comments

  • @neume-network we're dealing with many different formatted ipfs URIs ranging from all the sorts you're handling in your library
  • It's already useful that there is a library that can determine if something is an ipfs link or not, so that's great
  • but additionally, if we were able to extract a valid CID from that link it'd be even better
  • Sadly though, instead of returning the raw hash itself as the match for a CID, isIpfs returns a boolean as a result of isCID and so: Yes we know that something is an ipfs link but not which fragment is the hash: https://github.com/ipfs-shipyard/is-ipfs/blob/393859af921ef52d786c0f14bf772eeda7f8930b/src/index.js#L122
  • So potentially it'd make sense having a function determine that a link is a valid ipfs link
  • and then another function potentially matching and allowing the user to retrieve the hash

TimDaub avatar Sep 06 '22 09:09 TimDaub