Rebase against ca97cb87008293f7893a5dd4d082b50c2cfbfb81.

This commit is contained in:
Zebediah Figura 2024-02-13 17:26:54 -06:00
parent eedc72d581
commit 2491bcaac1
6 changed files with 1 additions and 206 deletions

View File

@ -1,70 +0,0 @@
From ad58ff0d742084c451a36ba46c53363752fcb8aa Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 28 Jun 2019 09:57:31 +1000
Subject: [PATCH] shlwapi: Support ./ in UrlCanonicalize.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=23166
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/kernelbase/path.c | 15 +++++++++++++++
dlls/shlwapi/tests/url.c | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 5f983895576..07457dcfc1b 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -3562,6 +3562,7 @@ HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWOR
* 4 have // 5,3
* 5 have 1[+] alnum 6,3
* 6 have location (found /) save root location
+ * 7 have ./
*/
wk1 = url;
@@ -3588,6 +3589,11 @@ HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWOR
state = 5;
is_file_url = TRUE;
}
+ else if (url[0] == '.' && url[1] == '/')
+ {
+ state = 7;
+ is_file_url = TRUE;
+ }
while (*wk1)
{
@@ -3792,6 +3798,15 @@ HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWOR
}
*wk2 = '\0';
break;
+ case 7:
+ if (flags & URL_DONT_SIMPLIFY)
+ {
+ state = 3;
+ break;
+ }
+ wk1 += 2;
+ state = 6;
+ break;
default:
FIXME("how did we get here - state=%d\n", state);
heap_free(url_copy);
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 703bdcd0a55..eea254442c6 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -185,6 +185,10 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"///A/../B", URL_WININET_COMPATIBILITY, "///B", FALSE},
{"A", 0, "A", FALSE},
{"../A", 0, "../A", FALSE},
+ {"./A", 0, "A", FALSE},
+ {"./A/./B", 0, "A/B", FALSE},
+ {"./A", URL_DONT_SIMPLIFY, "./A", FALSE},
+ {"A/./B", 0, "A/B", TRUE},
{"A/../B", 0, "B", TRUE},
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/,
{"http:www.winehq.org/dir/../index.html", 0, "http:www.winehq.org/index.html"},
--
2.34.1

View File

@ -1 +0,0 @@
Fixes: [23166] shlwapi: Support ./ in UrlCanonicalize.

View File

@ -1,90 +0,0 @@
From e6dac63a0b7a0fa9cde972c7f43ef970f865310f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 17 Jan 2014 01:19:41 +0100
Subject: [PATCH] shlwapi/tests: Add additional tests for UrlCombine and
UrlCanonicalize
---
dlls/shlwapi/tests/url.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index e8284e70d02..bc686c86609 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -183,6 +183,14 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"./A", URL_DONT_SIMPLIFY, "./A", FALSE},
{"A/./B", 0, "A/B", TRUE},
{"A/../B", 0, "B", TRUE},
+ {"A/../B/./../C", 0, "C", TRUE},
+ {"A/../B/./../C", URL_DONT_SIMPLIFY, "A/../B/./../C", FALSE},
+ {".\\A", 0, ".\\A", FALSE},
+ {"A\\.\\B", 0, "A\\.\\B", FALSE},
+ {".", 0, "/", TRUE},
+ {"./A", 0, "A", TRUE},
+ {"A/./B", 0, "A/B", TRUE},
+ {"/:test\\", 0, "/:test\\", TRUE},
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/,
{"http:www.winehq.org/dir/../index.html", 0, "http:www.winehq.org/index.html"},
{"http://localhost/test.html", URL_FILE_USE_PATHURL, "http://localhost/test.html"},
@@ -318,6 +326,7 @@ typedef struct _TEST_URL_COMBINE {
const char *url2;
DWORD flags;
const char *expecturl;
+ BOOL todo;
} TEST_URL_COMBINE;
static const TEST_URL_COMBINE TEST_COMBINE[] = {
@@ -1257,7 +1266,7 @@ static void test_UrlCanonicalizeW(void)
/* ########################### */
-static void check_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFlags, const char *szExpectUrl)
+static void check_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFlags, const char *szExpectUrl, BOOL todo)
{
HRESULT hr;
CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH];
@@ -1277,17 +1286,28 @@ static void check_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFl
dwSize = 0;
hr = UrlCombineA(szUrl1, szUrl2, NULL, &dwSize, dwFlags);
ok(hr == E_POINTER, "Checking length of string, return was 0x%08lx, expected 0x%08lx\n", hr, E_POINTER);
- ok(dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
+ ok(todo || dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
dwSize--;
hr = UrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
ok(hr == E_POINTER, "UrlCombineA returned 0x%08lx, expected 0x%08lx\n", hr, E_POINTER);
- ok(dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
+ ok(todo || dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
hr = UrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ok(dwSize == dwExpectLen, "Got length %ld, expected %ld\n", dwSize, dwExpectLen);
- ok(!strcmp(szReturnUrl, szExpectUrl), "Expected %s, got %s.\n", szExpectUrl, szReturnUrl);
+
+ if (todo)
+ {
+ todo_wine ok(dwSize == dwExpectLen && (FAILED(hr) || strcmp(szReturnUrl, szExpectUrl)==0),
+ "Expected %s (len=%ld), but got %s (len=%ld)\n", szExpectUrl, dwExpectLen, SUCCEEDED(hr) ? szReturnUrl : "(null)", dwSize);
+ }
+ else
+ {
+ ok(dwSize == dwExpectLen, "Got length %ld, expected %ld\n", dwSize, dwExpectLen);
+ if (SUCCEEDED(hr))
+ ok(strcmp(szReturnUrl, szExpectUrl)==0, "Expected %s, but got %s\n", szExpectUrl, szReturnUrl);
+ }
dwSize = 0;
hr = UrlCombineW(wszUrl1, wszUrl2, NULL, &dwSize, dwFlags);
@@ -1318,7 +1338,7 @@ static void test_UrlCombine(void)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(TEST_COMBINE); i++) {
- check_url_combine(TEST_COMBINE[i].url1, TEST_COMBINE[i].url2, TEST_COMBINE[i].flags, TEST_COMBINE[i].expecturl);
+ check_url_combine(TEST_COMBINE[i].url1, TEST_COMBINE[i].url2, TEST_COMBINE[i].flags, TEST_COMBINE[i].expecturl, TEST_COMBINE[i].todo);
}
}
--
2.35.1

View File

@ -1,42 +0,0 @@
From 38ec9774394d778a1f2fdbafb3e80eaf111a5edb Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 17 Jan 2014 01:27:53 +0100
Subject: [PATCH] shlwapi: UrlCombineW workaround for relative paths
---
dlls/kernelbase/path.c | 5 ++++-
dlls/shlwapi/tests/url.c | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 07457dcfc1b..665d0bb7355 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4926,7 +4926,10 @@ HRESULT WINAPI UrlCombineW(const WCHAR *baseW, const WCHAR *relativeW, WCHAR *co
work = preliminary + base.cchProtocol + 1 + base.cchSuffix - 1;
if (*work++ != '/')
*(work++) = '/';
- lstrcpyW(work, relative.pszSuffix);
+ if (relative.pszSuffix[0] == '.' && relative.pszSuffix[1] == 0)
+ *work = 0;
+ else
+ lstrcpyW(work, relative.pszSuffix);
break;
default:
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 8e17969d0c5..d696061377c 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -369,6 +369,8 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"http://www.winehq.org/test14#aaa/bbb#ccc", "#", 0, "http://www.winehq.org/test14#"},
{"http://www.winehq.org/tests/?query=x/y/z", "tests15", 0, "http://www.winehq.org/tests/tests15"},
{"http://www.winehq.org/tests/?query=x/y/z#example", "tests16", 0, "http://www.winehq.org/tests/tests16"},
+ {"http://www.winehq.org/tests17", ".", 0, "http://www.winehq.org/"},
+ {"http://www.winehq.org/tests18/test", ".", 0, "http://www.winehq.org/tests18/"},
{"file:///C:\\dir\\file.txt", "test.txt", 0, "file:///C:/dir/test.txt"},
{"file:///C:\\dir\\file.txt#hash\\hash", "test.txt", 0, "file:///C:/dir/file.txt#hash/test.txt"},
{"file:///C:\\dir\\file.html#hash\\hash", "test.html", 0, "file:///C:/dir/test.html"},
--
2.34.1

View File

@ -1,2 +0,0 @@
Fixes: Workaround for shlwapi URLs with relative paths
Depends: shlwapi-UrlCanonicalize

View File

@ -1 +1 @@
e8f4909ac3cc58e67ad73b9d4a0cbe6fe7b3bf90
ca97cb87008293f7893a5dd4d082b50c2cfbfb81