Skip to content

Allow semicolon in file path for Swift URL v2#1882

Merged
jrflat merged 2 commits intoswiftlang:mainfrom
jrflat:url-file-path-semicolon
Apr 9, 2026
Merged

Allow semicolon in file path for Swift URL v2#1882
jrflat merged 2 commits intoswiftlang:mainfrom
jrflat:url-file-path-semicolon

Conversation

@jrflat
Copy link
Copy Markdown
Contributor

@jrflat jrflat commented Apr 7, 2026

Maintain behavior of not encoding ; in the URL(filePath:) initializers when v2 is enabled.

Motivation:

NSURL and CFURL file path initializers encode semicolons in the path, but URL currently doesn't, and neither do any modern parsers. When using the shared code, we should still maintain the modern behavior for URL.

Modifications:

Plumb a compatibility: Bool through the respective functions to maintain the behavior when FOUNDATION_SWIFT_URL_V2 is enabled.

Result:

No behavior difference from current URL implementation (; is allowed unencoded).

Testing:

Added unit test to ensure non-encoding behavior of ; for URL file path APIs. Added NSURL unit tests to ensure we maintain its behavior of encoding ; in the file path for compatibility.

@jrflat jrflat requested a review from a team as a code owner April 7, 2026 18:15
@jrflat
Copy link
Copy Markdown
Contributor Author

jrflat commented Apr 7, 2026

@swift-ci please test

@itingliu
Copy link
Copy Markdown
Contributor

itingliu commented Apr 9, 2026

I think the current failing SwiftPM failures would be gone if you rebase

@jrflat jrflat force-pushed the url-file-path-semicolon branch from 11e1e30 to c352fa2 Compare April 9, 2026 18:24
@jrflat
Copy link
Copy Markdown
Contributor Author

jrflat commented Apr 9, 2026

@swift-ci please test

1 similar comment
@jrflat
Copy link
Copy Markdown
Contributor Author

jrflat commented Apr 9, 2026

@swift-ci please test

@jrflat jrflat merged commit 13a9723 into swiftlang:main Apr 9, 2026
22 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