Skip to content

fixGitURL: fix crash for "relative" file: paths and reject unsupported SCP URLs#14981

Merged
edolstra merged 1 commit intoNixOS:masterfrom
roberth:fix-git-relative-url-crash
Jan 13, 2026
Merged

fixGitURL: fix crash for "relative" file: paths and reject unsupported SCP URLs#14981
edolstra merged 1 commit intoNixOS:masterfrom
roberth:fix-git-relative-url-crash

Conversation

@roberth
Copy link
Member

@roberth roberth commented Jan 12, 2026

Relative paths (e.g., "relative/repo") would crash in renderAuthorityAndPath() because an empty authority was set, violating RFC 3986 section 3.3 which requires paths to start with "/" when an authority is present.

Fix by only setting authority for absolute paths:

  • Absolute paths: file:///path (empty authority)
  • Relative paths: file:path (no authority)

Also reject SCP-like URLs without a user (e.g., "github.com:path") with a clear error message, since proper support requires careful implementation, which is not something I can do right now.

Motivation

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Relative paths (e.g., "relative/repo") would crash in renderAuthorityAndPath()
because an empty authority was set, violating RFC 3986 section 3.3 which
requires paths to start with "/" when an authority is present.

Fix by only setting authority for absolute paths:
- Absolute paths: file:///path (empty authority)
- Relative paths: file:path (no authority)

Also reject SCP-like URLs without a user (e.g., "github.com:path") with a
clear error message, since proper support requires careful implementation,
which is not something I can do right now.
@roberth roberth requested a review from edolstra as a code owner January 12, 2026 12:05
@roberth roberth changed the title fixGitURL: fix crash for relative paths and reject unsupported SCP URLs fixGitURL: fix crash for "relative" file: paths and reject unsupported SCP URLs Jan 12, 2026
@edolstra edolstra added this pull request to the merge queue Jan 13, 2026
Merged via the queue into NixOS:master with commit 1b1c949 Jan 13, 2026
15 checks passed
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