You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have written the below test to illustrate what I suspect is a problem with the handling of slashes with file URIs.
[Test]
public void FlurlUrl_PreservesLeadingSlash()
{
var urlString = "file:///document";
var flurl = new Url(urlString);
Assert.AreEqual(urlString, flurl.ToString());
var queryKey = "queryKey";
var queryValue = "queryValue";
flurl = flurl.SetQueryParam(queryKey, queryValue);
Assert.AreEqual($"{urlString}?{queryKey}={queryValue}", flurl.ToString());
}
I would expect this test to pass, but instead it fails with the following message:
String lengths are both 36. Strings differ at index 7.
Expected: "file:///document?queryKey=queryValue"
But was: "file://document/?queryKey=queryValue"
In summary, I believe Flurl is removing that third slash and inadvertently generating an invalid URI.
Many thanks for your help.
The text was updated successfully, but these errors were encountered:
Interesting. I'll be honest, I didn't know the triple-slash notation was a thing when I wrote the normalization logic. But it looks legitimate and I'll make sure it's not tampered with when specified.
In summary, I believe Flurl is removing that third slash and inadvertently generating an invalid URI.
Technically not correct to say it's an invalid URI, but it's certainly the URI you expected, so point taken. 😉
Interesting. I'll be honest, I didn't know the triple-slash notation was a thing when I wrote the normalization logic. But it looks legitimate and I'll make sure it's not tampered with when specified.
In summary, I believe Flurl is removing that third slash and inadvertently generating an invalid URI.
Technically not correct to say it's an invalid URI, but it's certainly the URI you expected, so point taken. 😉
Hi,
I have written the below test to illustrate what I suspect is a problem with the handling of slashes with file URIs.
I would expect this test to pass, but instead it fails with the following message:
In summary, I believe Flurl is removing that third slash and inadvertently generating an invalid URI.
Many thanks for your help.
The text was updated successfully, but these errors were encountered: