Skip to content

feat(path): add NewPathFromURI for ipfs:// URIs#1182

Merged
gammazero merged 3 commits into
mainfrom
feat/new-path-from-uri
Jul 1, 2026
Merged

feat(path): add NewPathFromURI for ipfs:// URIs#1182
gammazero merged 3 commits into
mainfrom
feat/new-path-from-uri

Conversation

@lidel

@lidel lidel commented Jul 1, 2026

Copy link
Copy Markdown
Member

Add opt-in NewPathFromURI to parse native IPFS URIs (ipfs://, ipns:// and the schemeless ipfs:/ipns: forms) into canonical content paths, leaving NewPath strict

This is used in:

lidel added 2 commits July 1, 2026 01:59
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.
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.71%. Comparing base (e67e4cf) to head (66920fb).

Impacted file tree graph

@@            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              
Files with missing lines Coverage Δ
path/path.go 97.46% <ø> (ø)
path/uri.go 100.00% <100.00%> (ø)

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lidel lidel marked this pull request as ready for review July 1, 2026 00:16
@lidel lidel requested a review from a team as a code owner July 1, 2026 00:16
Comment thread path/uri.go Outdated
@gammazero gammazero merged commit 8a6d1d2 into main Jul 1, 2026
26 checks passed
@gammazero gammazero deleted the feat/new-path-from-uri branch July 1, 2026 04:17
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>
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.

2 participants