Skip to content

Compatibility path for apps looping on URL.deletingLastPathComponent().standardized #1114

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

Conversation

jrflat
Copy link
Contributor

@jrflat jrflat commented Jan 8, 2025

Compatibility path for apps that recurse on url = url.deletingPathComponent().standardized until url.path.isEmpty.

Before Swift URL, this used to work due to a combination of two bugs where:

URL("/").deletingLastPathComponent == URL("/../")
URL("/../").standardized == URL("")

both of which are incorrect behaviors. This PR adds a compatibility path to prevent the infinite loop and crash.

@jrflat
Copy link
Contributor Author

jrflat commented Jan 8, 2025

@swift-ci please test

@jrflat jrflat requested review from parkera and itingliu January 8, 2025 18:49
@jrflat jrflat merged commit bbe96fc into swiftlang:main Jan 10, 2025
3 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