Skip to content

fix: convert CIDv0 to CIDv1 before base32 encoding#265

Merged
lidel merged 1 commit intomainfrom
fix/base32-cidv0-to-cidv1
Feb 13, 2026
Merged

fix: convert CIDv0 to CIDv1 before base32 encoding#265
lidel merged 1 commit intomainfrom
fix/base32-cidv0-to-cidv1

Conversation

@lidel
Copy link
Member

@lidel lidel commented Feb 13, 2026

CIDv0 bytes are bare multihashes without version/codec prefix. Base32-encoding them directly produces an invalid CID string that spec-compliant parsers (like js-multiformats) reject.

@lidel lidel requested a review from achingbrain February 13, 2026 16:05
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@lidel lidel changed the title fix: convert CIDv0 to CIDv1 before base32 encoding in Base32Cid() fix: convert CIDv0 to CIDv1 before base32 encoding Feb 13, 2026
@lidel lidel force-pushed the fix/base32-cidv0-to-cidv1 branch from 5ebac0e to 1151145 Compare February 13, 2026 16:23
@github-actions
Copy link
Contributor

v0.10.1

Fixed

  • Renamed Base32Cid() to DNSSafeCidV1() and fixed it to convert CIDv0 to CIDv1 before encoding. Uses base36 for libp2p-key codec (IPNS keys) and base32 for everything else, producing valid DNS-safe CID strings for subdomain gateway tests. #264

renamed Base32Cid() to DNSSafeCidV1() to clarify intent.
uses base36 for libp2p-key codec (IPNS keys), base32 for everything else.
CIDv0 bytes are bare multihashes without version/codec prefix,
base32-encoding them directly produces an invalid CID string that
spec-compliant parsers (like js-multiformats) reject.

Fixes #264
@lidel lidel force-pushed the fix/base32-cidv0-to-cidv1 branch from 1151145 to ad98c7a Compare February 13, 2026 16:26
@lidel lidel marked this pull request as ready for review February 13, 2026 16:58
@lidel lidel merged commit e32d846 into main Feb 13, 2026
9 of 10 checks passed
@lidel lidel deleted the fix/base32-cidv0-to-cidv1 branch February 13, 2026 17:03
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.

_redirects tests use base32 CIDv0

1 participant