Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

gix_url::parse() incorrectly accepted URLs with whitespace in hostnames (e.g., "http://has a space"), diverging from RFC 3986 and the standard url crate behavior.

Changes:

  • Modified simple_url::normalize_hostname() to reject any whitespace characters (space, tab, newline, etc.) in hostnames
  • Added test coverage for whitespace validation in both integration and unit tests

Example:

// Before: incorrectly succeeded
gix_url::parse("http://has a space".into())  
// ✓ Ok(Url { host: Some("has a space"), .. })

// After: correctly rejects
gix_url::parse("http://has a space".into())
// ✗ Err(Url { source: InvalidDomainCharacter, .. })
Original prompt

#2355 Fix this - be sure to create a failing test first.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix issue 2355 by creating a failing test Reject whitespace in URL hostnames per RFC 3986 Jan 9, 2026
Copilot AI requested a review from Byron January 9, 2026 03:44
@Byron Byron linked an issue Jan 9, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits January 9, 2026 06:00
Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
@Byron Byron force-pushed the copilot/fix-failing-test-issue-2355 branch from 093cbc5 to 510244e Compare January 9, 2026 05:04
@Byron Byron marked this pull request as ready for review January 9, 2026 05:06
@Byron Byron enabled auto-merge January 9, 2026 05:06
@Byron
Copy link
Member

Byron commented Jan 9, 2026

When merged, there will be a follow-up that also validates that certain characters in the hier portion aren't allowed.

@Byron Byron merged commit 1f1a3d1 into main Jan 9, 2026
30 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.

gix_url successfully parses a url with spaces

2 participants