Skip to content

Conversation

@ificator
Copy link

This PR fixes #393.

Currently ToUriComponent will skip encoding the % when it looks like it's part of percent-encoded character:

var ps = new PathString("/test%20name.txt");
Console.WriteLine("{0}", ps.ToUriComponent()); // Output: /test%20name.txt

However, ToUriComponent should output a correctly encoded version of the decoded path represented by the PathString:

var ps = new PathString("/test%20name.txt");
Console.WriteLine("{0}", ps.ToUriComponent()); // Output: /test%2520name.txt

Said another way, the FromUriComponent and ToUriComponent methods should be symmetrical:

string input = "/test%2520name.txt";
var ps = PathString.FromUriComponent(input);
string output = ps.ToUriComponent();
Console.WriteLine("{0}", input == output); // Expect this to output 'true'

The fix is to remove the check for percent encoding.

@Tratcher
Copy link
Member

FYI this project is only receiving critical security fixes. Behavioral breaking changes are unlikely to be accepted.

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.

With 4.x release behavior of decoding url parameters (path and query parameters) has changed.

3 participants