#437 bug decoding encoded +

This commit is contained in:
Todd Menier 2019-04-26 12:52:00 -05:00
parent 521d855f33
commit 659e0fcf3f
2 changed files with 9 additions and 2 deletions

View File

@ -375,6 +375,14 @@ namespace Flurl.Test
Assert.AreEqual("http://www.mysite.com/a+b?c+d=1+2", url.ToString(true));
}
[Test] // #437
public void interprets_encoded_plus_as_plus() {
var urlStr = "http://google.com/search?q=param_with_%2B";
var url = new Url(urlStr);
var paramValue = url.QueryParams["q"];
Assert.AreEqual("param_with_+", paramValue);
}
[TestCase("http://www.mysite.com/more", true)]
[TestCase("http://www.mysite.com/more?x=1&y=2", true)]
[TestCase("http://www.mysite.com/more?x=1&y=2#frag", true)]

View File

@ -144,8 +144,7 @@ namespace Flurl
if (string.IsNullOrEmpty(s))
return s;
s = Uri.UnescapeDataString(s);
return interpretPlusAsSpace ? s.Replace("+", " ") : s;
return Uri.UnescapeDataString(interpretPlusAsSpace ? s.Replace("+", " ") : s);
}
private const int MAX_URL_LENGTH = 65519;