diff options
author | Alexis Christoforides <alexis@thenull.net> | 2017-10-13 00:03:01 +0300 |
---|---|---|
committer | <alexischr@apepe.localdomain> | 2017-10-19 02:33:56 +0300 |
commit | 0ccfa87a91e1ff571527973405991a8213c3cf86 (patch) | |
tree | 93dde3b42996a3107e94761869cc4b494d8e1691 /mcs | |
parent | 4fe87bd820cdeeabb4f2865c8144d608078b32a3 (diff) |
[System.URI] Don't reset host string processing on Unicode paths. Fixes #56003
This may not be the final fix; the Mono-only workaround was introduced in b5dc9a4951bd35b61b29faa4df93bca3c31bfa3e to fix a crash with Unicode paths in TryCreate. However the test case for that issue now succeeds without the workaround.
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System/Test/System/UriTest.cs | 11 | ||||
-rw-r--r-- | mcs/class/referencesource/System/net/System/URI.cs | 7 |
2 files changed, 11 insertions, 7 deletions
diff --git a/mcs/class/System/Test/System/UriTest.cs b/mcs/class/System/Test/System/UriTest.cs index b6bc2b8f15b..2db2fb21283 100644 --- a/mcs/class/System/Test/System/UriTest.cs +++ b/mcs/class/System/Test/System/UriTest.cs @@ -2071,5 +2071,16 @@ namespace MonoTests.System var uri = new Uri ("https://_foo/bar.html"); Assert.AreEqual ("https", uri.Scheme); } + + [Test] + public void ImplicitUnixFileWithUnicodeGetAbsoluleUri () + { + if (isWin32) + Assert.Ignore (); + + string escFilePath = "/Users/Текст.txt"; + string escUrl = new Uri (escFilePath, UriKind.Absolute).AbsoluteUri; + Assert.AreEqual ("file:///Users/%D0%A2%D0%B5%D0%BA%D1%81%D1%82.txt", escUrl); + } } } diff --git a/mcs/class/referencesource/System/net/System/URI.cs b/mcs/class/referencesource/System/net/System/URI.cs index 73e505d344e..24ddbc66e15 100644 --- a/mcs/class/referencesource/System/net/System/URI.cs +++ b/mcs/class/referencesource/System/net/System/URI.cs @@ -3969,13 +3969,6 @@ namespace System { if (hasUnicode && iriParsing && hostNotUnicodeNormalized){ flags |= Flags.HostUnicodeNormalized;// no host -#if MONO - // I am not certain this is the best fix but for Unix implicit paths with - // unicode characters the host must be valid (null or non-empty) as - // CreateUriInfo assumes. This should happen only for paths like /foo/path-with-unicode - if (newHost.Length == 0 && (flags & Flags.BasicHostType) != 0) - newHost = null; -#endif } return idx; |