feat(path): add NewPathFromURI for ipfs:// URIs#1182
Merged
Conversation
NewPathFromURI rewrites native IPFS URIs (ipfs://, ipns://, ipld:// and the schemeless ipfs:/ipns:/ipld: forms) to canonical content paths, then delegates to NewPath. This lets values copied from browsers and other tools be parsed without hand-stripping the scheme. NewPath stays strict and keeps rejecting URI-shaped strings: it is fed untrusted input such as DNSLink TXT records, where accepting ipns:// would broaden the DNSLink format and enable confusion. URI handling is therefore opt-in. The scheme is matched case-insensitively over ASCII; the CID or name after it is preserved byte-for-byte, so CIDv0 roots and DNSLink names are unaffected.
# Conflicts: # CHANGELOG.md
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1182 +/- ##
==========================================
+ Coverage 63.67% 63.71% +0.03%
==========================================
Files 268 269 +1
Lines 26984 27003 +19
==========================================
+ Hits 17183 17204 +21
+ Misses 8093 8091 -2
Partials 1708 1708
... and 11 files with indirect coverage changes 🚀 New features to boost your workflow:
|
gammazero
approved these changes
Jul 1, 2026
lidel
added a commit
to ipfs/kubo
that referenced
this pull request
Jul 2, 2026
* feat: accept native ipfs:// and ipns:// URIs Commands that take a content path or CID now also accept native IPFS URIs (ipfs://cid, ipns://name, and the schemeless ipfs:/ipns: forms), so a URI copied from a browser or another tool works as-is. - cmdutils: PathOrCidPath parses via boxo NewPathFromURI; new CidFromArg for raw-CID commands takes the root CID and rejects sub-paths and mutable IPNS. - files: cp/stat sources and getNodeFromPath accept URIs and content paths; chroot takes its CID via CidFromArg. - resolve and name resolve normalize URIs before the namespace checks; name resolve stays IPNS-only. - routing, provide, filestore, pin remote: raw-CID args via CidFromArg. Depends on boxo NewPathFromURI (ipfs/boxo#1182); go.mod pins the PR commit until it is released. * depend on boxo@main * test: fix telemetry opt-out assertions #11374 made telemetry opt-in and rewrote the explicit "off" mode to no longer log "telemetry disabled via opt-out", but the opt-out subtests still assert that string, so TestTelemetry is red on master. Assert the "telemetry collection skipped: opted out" message the daemon emits whenever telemetry is off. * ci: inject .aegir.js for helia interop @helia/interop v11.0.0+ ships without .aegir.js (ipfs/helia#1049), so aegir test finds no specs and the interop job fails. Inject a minimal config pointing at the prebuilt dist specs when it is missing. Helia's own .aegir.js can't be reused as-is: it globs source .ts specs that Node won't run from node_modules. The same omission regressed before (ipfs/helia#1001, fixed by ipfs/helia#1003); see the comment. * ci: force mocha exit after helia interop run The node interop specs leave kubo daemon and libp2p handles open, so mocha prints "N passing" and then hangs until the job timeout instead of exiting. Pass --exit so mocha quits once the run completes. --------- Co-authored-by: Andrew Gillis <11790789+gammazero@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add opt-in
NewPathFromURIto parse native IPFS URIs (ipfs://,ipns://and the schemelessipfs:/ipns:forms) into canonical content paths, leavingNewPathstrictThis is used in: