Skip to content

Restore selective nil path behavior for bridged NSURLs #1278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025

Conversation

jrflat
Copy link
Contributor

@jrflat jrflat commented May 1, 2025

Fixes a compatibility issue that occurs when a URL such as scheme://?query is bridged to an NSURL. NSURL originally expected .path to return nil for this string, but URL and RFC 3986 say that the path always exists and is the empty string in this case. URL would then store an empty path range instead when bridging to NSURL, causing this discrepancy.

This PR fixes the issue during bridging by only storing the path range if NSURL would think there's a path, i.e. in the case where 1) the path is not empty, or 2) the path is empty, but we have a non-empty authority component.

@jrflat
Copy link
Contributor Author

jrflat commented May 1, 2025

@swift-ci please test

@jrflat jrflat requested review from parkera and jmschonfeld May 2, 2025 17:34
@jrflat jrflat merged commit e6fc85a into swiftlang:main May 2, 2025
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