Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Add tests for double-encoded URLs to both UrlDecode() methods#37881

Merged
wtgodbe merged 2 commits intodotnet:masterfrom
wtgodbe:UrlEncodeTest
May 31, 2019
Merged

Add tests for double-encoded URLs to both UrlDecode() methods#37881
wtgodbe merged 2 commits intodotnet:masterfrom
wtgodbe:UrlEncodeTest

Conversation

@wtgodbe
Copy link
Copy Markdown
Member

@wtgodbe wtgodbe commented May 22, 2019

Just a rough pass at testing the behavior described in https://github.com/dotnet/corefx/issues/36532.

CC @scalablecory @daohunliwei

@wtgodbe wtgodbe added this to the 3.0 milestone May 22, 2019

// Double encoded
yield return Tuple.Create("https%3a%2f%2ffoo.com%2fbar%2fbaz%3fsignature%3dFHOywukz2tdfFpx2dPg5medckUMauhAFOuppnDx%252b2NQ%253d", "https://foo.com/bar/baz?signature=FHOywukz2tdfFpx2dPg5medckUMauhAFOuppnDx%2b2NQ%3d");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are we adding a complicated test case like this one? If we are targeting special combination, we should ideally keep just that. Or simplify it.
Real-world tests are harder to reason about when they fail :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@karelz good call - I put up this PR with the original String (modulo the foo/bar/baz section) to get CI to run the tests while I looked at something else. Once the tests are finished I'll push another commit to truncate the test cases to just some simpler double-encoded strings (in this case, the double encoded section is the %252b2NQ%253d)

@wtgodbe
Copy link
Copy Markdown
Member Author

wtgodbe commented May 23, 2019

Failing tests were in System.Resources.Reader, System.Text.RegularExpressions, and System.Threading.Tasks, so unrelated to the tests added in this PR. Re-running the failed jobs now

@wtgodbe
Copy link
Copy Markdown
Member Author

wtgodbe commented May 30, 2019

@davidsh @karelz @wfurt @scalablecory can I get a review on this?

@wfurt wfurt requested a review from a team May 30, 2019 17:58
Copy link
Copy Markdown
Contributor

@davidsh davidsh left a comment

Choose a reason for hiding this comment

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

LGTM.

Does WebUtility.UrlDecode behave the same way? Should we also add these new tests to those unit tests as well?

@wtgodbe wtgodbe merged commit b2fd315 into dotnet:master May 31, 2019
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…/corefx#37881)

* Add tests for double-encoded URLs to both UrlDecode() methods

* Make test cases more clear


Commit migrated from dotnet/corefx@b2fd315
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants