Commit e2f2ad0e authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

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=48242Signed-off-by: 's avatarDamjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 675e0611
......@@ -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;
......
......@@ -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 */
......
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