Commit c79c8494 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

urlmon: Strip forward and back slashes when using the file: protocol.

parent 9eaab2ce
......@@ -141,7 +141,10 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
file_name = url+sizeof(wszFile)/sizeof(WCHAR);
if(file_name[0] == '/' && file_name[1] == '/')
/* Strip both forward and back slashes */
if( (file_name[0] == '/' && file_name[1] == '/') ||
(file_name[0] == '\\' && file_name[1] == '\\'))
file_name += 2;
if(*file_name == '/')
file_name++;
......
......@@ -2241,6 +2241,7 @@ static void test_file_protocol(void) {
static const WCHAR wszFile[] = {'f','i','l','e',':',0};
static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/',0};
static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0};
static const WCHAR wszFile4[] = {'f','i','l','e',':','\\','\\',0};
static const char html_doc[] = "<HTML></HTML>";
trace("Testing file protocol...\n");
......@@ -2306,6 +2307,20 @@ static void test_file_protocol(void) {
bindf = BINDF_FROMURLMON;
test_file_protocol_url(buf);
memcpy(buf, wszFile4, sizeof(wszFile4));
len = GetCurrentDirectoryW(sizeof(file_name_buf)/sizeof(WCHAR), file_name_buf);
file_name_buf[len++] = '\\';
memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml));
lstrcpyW(buf+sizeof(wszFile4)/sizeof(WCHAR)-1, file_name_buf);
file_name = file_name_buf;
bindf = 0;
test_file_protocol_url(buf);
bindf = BINDF_FROMURLMON;
test_file_protocol_url(buf);
buf[sizeof(wszFile4)/sizeof(WCHAR)] = '|';
test_file_protocol_url(buf);
DeleteFileW(wszIndexHtml);
bindf = 0;
......
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