Commit 283012cc authored by Petr Dlouhý's avatar Petr Dlouhý Committed by Alexandre Julliard

shlwapi: UrlCanonicalize will canonize address in format "file://localhost/c:/" correctly.

parent 4513fb38
......@@ -74,6 +74,10 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"file:///c:/tests\\foo%20bar", URL_UNESCAPE , S_OK, "file:///c:/tests/foo bar", FALSE},
{"file:///c:/tests/foo%20bar", 0, S_OK, "file:///c:/tests/foo%20bar", FALSE},
{"file:///c:/tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://localhost/c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://localhost\\c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://localhost\\\\c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://localhost\\c:\\tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://c:/tests\\../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
{"file://c:/tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\\tests\\foo bar", FALSE},
......
......@@ -319,6 +319,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
WCHAR slash = '/';
static const WCHAR wszFile[] = {'f','i','l','e',':'};
static const WCHAR wszLocalhost[] = {'l','o','c','a','l','h','o','s','t'};
TRACE("(%s, %p, %p, 0x%08x) *pcchCanonicalized: %d\n", debugstr_w(pszUrl), pszCanonicalized,
pcchCanonicalized, dwFlags, pcchCanonicalized ? *pcchCanonicalized : -1);
......@@ -387,6 +388,12 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
*wk2++ = *wk1++;
if (*wk1 != '/') {state = 6; break;}
*wk2++ = *wk1++;
if((dwFlags & URL_FILE_USE_PATHURL) && nByteLen >= sizeof(wszLocalhost)
&& !memcmp(wszLocalhost, wk1, sizeof(wszLocalhost))){
wk1 += sizeof(wszLocalhost)/sizeof(WCHAR);
while(*wk1 == '\\' && (dwFlags & URL_FILE_USE_PATHURL))
wk1++;
}
if(*wk1 == '/' && (dwFlags & URL_FILE_USE_PATHURL))
wk1++;
state = 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment