In the following code of JsonHttpClient.cs of ServiceStack library the absoluteUrl is malformed:
absoluteUrl = new Uri(absoluteUrl).ToString();
For example, if absoluteUrl contains a value of:
https://somedomain/imagestream?locationCode=TitelDia&relativePath=Marketing%20en%20Sales&fileName=M%26S_titel_1.jpeg
then after executing the code line, the absoluteUrl contains value:
https://somedomain/imagestream?locationCode=TitelDia&relativePath=Marketing en Sales&fileName=M&S_titel_1.jpeg
Note that %20 and %26 are changed to the canonical values as documented in the Microsoft documentation.
The unescaped canonical representation of the Uri instance. All characters are unescaped except #, ?, and %.
Others are also complaining about the usage of uri.ToString() and that its usage is almost certain a bug.
Is the usage of uri.ToString() in ServiceStack indeed a bug and it should be changed to AbsoluteUri?
This behavior causes unwanted behavior on the server side, because the malformed url / query string is sent to the server. The value of fileName on the server is 'M' instead of 'M&S_titel_1.jpg'.
I've just replaced usages of Uri.ToString() to Uri.AbsoluteUri in this commit as suggested.
This change is available from v8.8.1+ that's now available in pre-release packages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With