shlwapi: Remove dot segments for URLs starting with /.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2016-11-23 14:20:24 -08:00 committed by Alexandre Julliard
parent 2b09cfe928
commit 4eac6e84ba
2 changed files with 12 additions and 0 deletions

View file

@ -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},

View file

@ -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) {