Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support base cid encodings #148

Merged
merged 1 commit into from Jul 28, 2022
Merged

Conversation

vasco-santos
Copy link
Member

This PR adds support for gateway to try to resolve CIDs encoded into more bases than b32 and b58. It includes all the basic bases exported by multiformats module.

ipfs-core-utils was added to have a quick way of getting what base decoder we want to try.

Closes #111

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jun 20, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: f89f851
Status: ✅  Deploy successful!
Preview URL: https://0673bfe5.nftstorage-link.pages.dev
Branch Preview URL: https://feat-support-base-cid-encodi.nftstorage-link.pages.dev

View logs

@vasco-santos vasco-santos force-pushed the feat/support-base-cid-encodings branch from 6fdd386 to 811fc79 Compare June 20, 2022 15:52
*
* @param {string} cid
*/
async function normalizeCidV1(cid) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created new one as per CID spec when cidv0 we don't have a multibasePrefix. normalizeCidV1 always comes from this path as function is not exported and is used on subdomain

@vasco-santos vasco-santos force-pushed the feat/support-base-cid-encodings branch from 70c3f8e to f89f851 Compare July 28, 2022 07:31
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@990e4f6). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #148   +/-   ##
=======================================
  Coverage        ?   98.98%           
=======================================
  Files           ?        4           
  Lines           ?      491           
  Branches        ?        0           
=======================================
  Hits            ?      486           
  Misses          ?        5           
  Partials        ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gateway does not resolve all CID encodings
2 participants