Module: wine Branch: master Commit: e2f2ad0e81b854b5b18d029d309708d8ea7dd7bb URL: https://source.winehq.org/git/wine.git/?a=commit;h=e2f2ad0e81b854b5b18d029d3...
Author: Damjan Jovanovic damjan.jov@gmail.com Date: Sun Dec 8 19:48:50 2019 +0200
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
---
dlls/msxml3/bsc.c | 10 +++++++--- dlls/msxml3/tests/domdoc.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/msxml3/bsc.c b/dlls/msxml3/bsc.c index df4cf37346..0b9e679bda 100644 --- a/dlls/msxml3/bsc.c +++ b/dlls/msxml3/bsc.c @@ -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; diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index c4337ab191..aa4c7a2832 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -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 */