From d75e760cf8d7ffb02d1e013eda41c6c2fef3dfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Se=C3=A7kin?= Date: Tue, 10 Apr 2018 10:23:45 +0100 Subject: [PATCH 1/2] Unescape JSON values to avoid malformed URIs When used against LocatorHub (our version was 10.2.2), the LocatorHub responses contain escaped forward slashes (`\/`), which in turn causes the requests to end up with the following exception: UriFormatException: Invalid URI: The hostname could not be parsed. --- DotNet/proxy.ashx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotNet/proxy.ashx b/DotNet/proxy.ashx index 607de6c6..5379719b 100644 --- a/DotNet/proxy.ashx +++ b/DotNet/proxy.ashx @@ -886,7 +886,7 @@ public class proxy : IHttpHandler { ) ); } - return value; + return Regex.Unescape(value); } private int indexOf_HighFlag(string text, string key) { From 733a1f2b20348ca5da1b86573daa7c798028cae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Se=C3=A7kin?= Date: Wed, 11 Apr 2018 09:58:24 +0100 Subject: [PATCH 2/2] Replace escaped slashes with normal ones Use `string.Replace` instead of `Regex.Unescape()` to minimise the risk of unintended replacements. --- DotNet/proxy.ashx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotNet/proxy.ashx b/DotNet/proxy.ashx index 5379719b..89a1186e 100644 --- a/DotNet/proxy.ashx +++ b/DotNet/proxy.ashx @@ -886,7 +886,7 @@ public class proxy : IHttpHandler { ) ); } - return Regex.Unescape(value); + return value.Replace("\\/", "/"); } private int indexOf_HighFlag(string text, string key) {