msxml3: All string passed to IXMLDOMDocument_load() need to be URL-unescaped.

msxml3 allows URL escape sequences even for C:\ style paths.
eg. C:\Program%20Files\...

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48242
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Damjan Jovanovic 2019-12-08 19:48:50 +02:00 committed by Alexandre Julliard
parent 675e061142
commit e2f2ad0e81
2 changed files with 24 additions and 3 deletions

View File

@ -253,15 +253,19 @@ HRESULT create_uri(const WCHAR *url, IUri **uri)
WCHAR fullpath[MAX_PATH];
DWORD needed = ARRAY_SIZE(fileUrl);
if (!PathSearchAndQualifyW(url, fullpath, ARRAY_SIZE(fullpath)))
lstrcpynW(fileUrl, url, ARRAY_SIZE(fileUrl));
UrlUnescapeW(fileUrl, NULL, NULL, URL_UNESCAPE_INPLACE);
if (!PathSearchAndQualifyW(fileUrl, fullpath, ARRAY_SIZE(fullpath)))
{
WARN("can't find path\n");
return E_FAIL;
}
if (FAILED(UrlCreateFromPathW(fullpath, fileUrl, &needed, 0)))
if (FAILED(UrlApplySchemeW(fullpath, fileUrl, &needed, URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE |
URL_APPLY_DEFAULT)))
{
ERR("can't create url from path\n");
ERR("Failed to apply url scheme.\n");
return E_FAIL;
}
url = fileUrl;

View File

@ -10219,6 +10219,7 @@ static void test_load(void)
VARIANT src;
HRESULT hr;
void* ptr;
int n;
GetTempPathA(MAX_PATH, path);
strcat(path, "winetest.xml");
@ -10268,6 +10269,22 @@ static void test_load(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
SysFreeString(bstr1);
/* Regular local path with some URL encoded characters. */
strcpy(path2, path);
n = strlen(path2);
strcpy(&path2[n-1], "%6C"); /* C:\path\to\winetest.xm%6C */
test_doc_load_from_path(doc, path2);
/* Both spaces and %20s work. */
GetTempPathA(MAX_PATH, path2);
strcat(path2, "wine test.xml");
write_to_file(path2, win1252xml);
test_doc_load_from_path(doc, path2);
GetTempPathA(MAX_PATH, path2);
strcat(path2, "wine%20test.xml");
test_doc_load_from_path(doc, path2);
DeleteFileA(path2);
DeleteFileA(path);
/* load from existing path, no xml content */