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

Cannot round trip some query string styles #25

Open
Nevett opened this issue Oct 25, 2019 · 1 comment
Open

Cannot round trip some query string styles #25

Nevett opened this issue Oct 25, 2019 · 1 comment

Comments

@Nevett
Copy link
Contributor

Nevett commented Oct 25, 2019

MustardBlack.Url changes the query portion of a URI when roundtripping it

e.g.
(new MustardBlack.Url(str)).ToString()

https://www.test.com/?c=foo&b=bar&a=baz becomes https://www.test.com/?a=baz&b=bar&c=foo
https://www.test.com/?a=1&a=2&a=3 becomes https://www.test.com/?a=1%2c2%2c3

This is a problem since MustardBlack.Url is used internally when creating RedirectResults from URL strings, therefore it is not possible to redirect a user to an arbitrary url with confidence it will not be mangled.

Since RFC 3986 offers little specification on the format of query portions of URLs, the safest thing to do would be to preserve whatever is passed in, in scenarios where the Url.QueryCollection is not mutated.

System.Uri handles this use case okay, but is immutable.

@Nevett
Copy link
Contributor Author

Nevett commented Oct 25, 2019

An alternative fix (for the particular problem with redirects) could be to have RedirectResult use System.Uri or just string internally since it doesn't make use of the mutability of MustardBlack.Url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant