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

Work around empty query components bug. #86

Merged
merged 6 commits into from
Dec 4, 2017
Merged

Work around empty query components bug. #86

merged 6 commits into from
Dec 4, 2017

Conversation

mbrandonw
Copy link
Member

I just filed this bug https://bugs.swift.org/browse/SR-6405 and this PR works around it.

Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

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

Dang! Good find

(
data.path.isEmpty && data.query.isEmpty
? (base ?? URL(string: "/"))
: urlComponents(from: data).url(relativeTo: base)
Copy link
Member Author

Choose a reason for hiding this comment

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

this was coming back nil on linux, so we have to first check if path+query are empty, and if so just default to the base url.

@@ -4,6 +4,7 @@ import Either
import Prelude

enum Routes {
case home
Copy link
Member Author

@mbrandonw mbrandonw Dec 4, 2017

Choose a reason for hiding this comment

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

we weren't seeing this bug in the tests cause the root route technically when to the url /home. I've now create a separate home route so that we can test both and fully root URL and something with path components.

@mbrandonw mbrandonw merged commit 3497760 into master Dec 4, 2017
@mbrandonw mbrandonw deleted the linux-bug branch December 4, 2017 18:35
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