Skip to content

urlapi: fix handling of "file:///"#21070

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/file-byte-path
Closed

urlapi: fix handling of "file:///"#21070
bagder wants to merge 1 commit intomasterfrom
bagder/file-byte-path

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 23, 2026

When the path is exactly one byte, a single slash.

Extended test 1560 to verify.

Found by Codex Security

When the path is exactly one byte, a single slash.

Extended test 1560 to verify.

Found by Codex Security
@bagder bagder added the URL label Mar 23, 2026
@github-actions github-actions bot added the tests label Mar 23, 2026
@bagder bagder requested a review from Copilot March 23, 2026 08:21
@bagder bagder marked this pull request as ready for review March 23, 2026 08:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an edge case in the URL API where file:/// (path length exactly 1 byte: /) was not handled correctly, and extends the existing URL parsing test coverage to lock in the behavior.

Changes:

  • Adjust lib/urlapi.c path handling to retain a 1-byte path for the file scheme (so file:/// remains valid/serializable).
  • Plumb a file-scheme indicator into handle_path() so the minimum stored path length differs for file vs other schemes.
  • Extend tests/libtest/lib1560.c with new file:/// and dot-segment normalization cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/urlapi.c Ensures file-scheme paths of length 1 ("/") are preserved so file:/// can be parsed and re-serialized safely.
tests/libtest/lib1560.c Adds regression cases for file:/// and file:///./ / file:///.' normalization to file:///.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder closed this in e0be05c Mar 23, 2026
@bagder bagder deleted the bagder/file-byte-path branch March 23, 2026 09:18
dkarpov1970 pushed a commit to dkarpov1970/curl that referenced this pull request Mar 25, 2026
When the path is exactly one byte, a single slash.

Extended test 1560 to verify.

Found by Codex Security

Closes curl#21070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants