Skip to content
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

URL.absoluteString crashes if baseURL starts with colon #1119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jrflat
Copy link
Contributor

@jrflat jrflat commented Jan 13, 2025

Recent regression from reverting to compatibility URL behaviors in #1113.

URL.absoluteString uses URLComponents to build the string from the correct parts of the relative and base URLs. After allowing URL to have an empty scheme for compatibility in #1113, URL.absoluteString would crash if we used an empty scheme from the base URL. The crash occurs when we assign components.scheme = "" since URLComponents does not consider an empty scheme valid.

Since we are only using URLComponents to produce an absolute string, we can bypass the scheme validation with an internal function, since the scheme used for the URL's absoluteString has already been validated by the base URL.

@jrflat
Copy link
Contributor Author

jrflat commented Jan 13, 2025

@swift-ci please test

@jrflat jrflat requested review from parkera and itingliu January 13, 2025 18:18
@jrflat
Copy link
Contributor Author

jrflat commented Jan 13, 2025

@swift-ci please test macOS Platform

3 similar comments
@jrflat
Copy link
Contributor Author

jrflat commented Jan 14, 2025

@swift-ci please test macOS Platform

@jrflat
Copy link
Contributor Author

jrflat commented Jan 14, 2025

@swift-ci please test macOS Platform

@jrflat
Copy link
Contributor Author

jrflat commented Jan 15, 2025

@swift-ci please test macOS Platform

@itingliu
Copy link
Contributor

@swift-ci please test

1 similar comment
@itingliu
Copy link
Contributor

@swift-ci please test

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