Commit 8a6210d2 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

urlmon: Improved url canonicalize when Uri_CREATE_FILE_USE_DOS_PATH is specified.

parent 92f41c56
......@@ -3744,6 +3744,35 @@ static const uri_properties uri_tests[] = {
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
/* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
{ "file:///c:/dir\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH
|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE
|Uri_HAS_SCHEME, FALSE,
{
{"file://c:\\dir\%a _name\\file*.html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"file://c:\\dir\%a _name\\file*.html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{".html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"c:\\dir\%a _name\\file*.html",S_OK,FALSE},
{"c:\\dir\%a _name\\file*.html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"file:///c:/dir\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
{"file",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{0,S_OK,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_FILE,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH
|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE
......
......@@ -2870,6 +2870,7 @@ static BOOL canonicalize_authority(const parse_data *data, Uri *uri, DWORD flags
* NOTES:
* file://c:/test%20test -> file:///c:/test%2520test
* file://c:/test%3Etest -> file:///c:/test%253Etest
* if Uri_CREATE_FILE_USE_DOS_PATH is not set:
* file:///c:/test%20test -> file:///c:/test%20test
* file:///c:/test%test -> file:///c:/test%25test
*/
......@@ -2931,7 +2932,7 @@ static BOOL canonicalize_path_hierarchical(const parse_data *data, Uri *uri,
WCHAR val;
/* Check if the % represents a valid encoded char, or if it needs encoded. */
BOOL force_encode = !check_pct_encoded(&tmp) && is_file;
BOOL force_encode = !check_pct_encoded(&tmp) && is_file && !(flags&Uri_CREATE_FILE_USE_DOS_PATH);
val = decode_pct_val(ptr);
if(force_encode || escape_pct) {
......@@ -2940,7 +2941,8 @@ static BOOL canonicalize_path_hierarchical(const parse_data *data, Uri *uri,
pct_encode_val(*ptr, uri->canon_uri+uri->canon_len);
uri->canon_len += 3;
} else if((is_unreserved(val) && known_scheme) ||
(is_file && (is_unreserved(val) || is_reserved(val)))) {
(is_file && (is_unreserved(val) || is_reserved(val) ||
(val && flags&Uri_CREATE_FILE_USE_DOS_PATH && !is_forbidden_dos_path_char(val))))) {
if(!computeOnly)
uri->canon_uri[uri->canon_len] = val;
++uri->canon_len;
......
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