Daniel Lehman : shlwapi: Remove dot segments for URLs starting with /.

Alexandre Julliard julliard at winehq.org
Wed Nov 30 16:56:57 CST 2016


Module: wine
Branch: master
Commit: 4eac6e84ba4b999c234215a28314074b9581266a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4eac6e84ba4b999c234215a28314074b9581266a

Author: Daniel Lehman <dlehman at esri.com>
Date:   Wed Nov 23 14:20:24 2016 -0800

shlwapi: Remove dot segments for URLs starting with /.

Signed-off-by: Daniel Lehman <dlehman at esri.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shlwapi/tests/url.c | 9 +++++++++
 dlls/shlwapi/url.c       | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 2cb6fea..f9fc79a 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -193,6 +193,15 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
     {"res://c:\\tests/res\\foo%20bar/strange\\sth", 0, S_OK, "res://c:\\tests/res\\foo%20bar/strange\\sth", FALSE},
     {"res://c:\\tests/res\\foo%20bar/strange\\sth", URL_FILE_USE_PATHURL, S_OK, "res://c:\\tests/res\\foo%20bar/strange\\sth", FALSE},
     {"res://c:\\tests/res\\foo%20bar/strange\\sth", URL_UNESCAPE, S_OK, "res://c:\\tests/res\\foo bar/strange\\sth", FALSE},
+    {"/A/../B/./C/../../test_remove_dot_segments", 0, S_OK, "/test_remove_dot_segments", FALSE},
+    {"/A/../B/./C/../../test_remove_dot_segments", URL_FILE_USE_PATHURL, S_OK, "/test_remove_dot_segments", FALSE},
+    {"/A/../B/./C/../../test_remove_dot_segments", URL_WININET_COMPATIBILITY, S_OK, "/test_remove_dot_segments", FALSE},
+    {"/A/B\\C/D\\E", 0, S_OK, "/A/B\\C/D\\E", FALSE},
+    {"/A/B\\C/D\\E", URL_FILE_USE_PATHURL, S_OK, "/A/B\\C/D\\E", FALSE},
+    {"/A/B\\C/D\\E", URL_WININET_COMPATIBILITY, S_OK, "/A/B\\C/D\\E", FALSE},
+    {"///A/../B", 0, S_OK, "///B", FALSE},
+    {"///A/../B", URL_FILE_USE_PATHURL, S_OK, "///B", FALSE},
+    {"///A/../B", URL_WININET_COMPATIBILITY, S_OK, "///B", FALSE},
     {"A", 0, S_OK, "A", FALSE},
     {"../A", 0, S_OK, "../A", FALSE},
     {"A/../B", 0, S_OK, "B", TRUE},
diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c
index 879a734..2caf998 100644
--- a/dlls/shlwapi/url.c
+++ b/dlls/shlwapi/url.c
@@ -372,6 +372,9 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
             dwFlags |= URL_ESCAPE_UNSAFE;
         state = 5;
         is_file_url = TRUE;
+    } else if(url[0] == '/') {
+        state = 5;
+        is_file_url = TRUE;
     }
 
     while (*wk1) {




More information about the wine-cvs mailing list