itss: Fix handling URLs without '/' in object name.

This commit is contained in:
Jacek Caban 2007-02-10 16:30:42 +01:00 committed by Alexandre Julliard
parent 5bc1a8de87
commit 73452e90a4
2 changed files with 11 additions and 1 deletions

View File

@ -180,13 +180,20 @@ static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
object_name += 2; object_name += 2;
memset(&chm_object, 0, sizeof(chm_object)); memset(&chm_object, 0, sizeof(chm_object));
res = chm_resolve_object(chm_file, object_name, &chm_object); res = chm_resolve_object(chm_file, object_name, &chm_object);
if(res != CHM_RESOLVE_SUCCESS && object_name[0] != '/') {
WCHAR tmp_obj_name[MAX_PATH];
tmp_obj_name[0] = '/';
strcpyW(tmp_obj_name+1, object_name);
res = chm_resolve_object(chm_file, tmp_obj_name, &chm_object);
}
if(res != CHM_RESOLVE_SUCCESS) { if(res != CHM_RESOLVE_SUCCESS) {
WARN("Could not resolve chm object\n"); WARN("Could not resolve chm object\n");
chm_close(chm_file); chm_close(chm_file);
return report_result(pOIProtSink, STG_E_FILENOTFOUND); return report_result(pOIProtSink, STG_E_FILENOTFOUND);
} }
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, object_name+1); IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST,
object_name[0] == '/' ? object_name+1 : object_name);
/* FIXME: Native doesn't use FindMimeFromData */ /* FIXME: Native doesn't use FindMimeFromData */
hres = FindMimeFromData(NULL, szUrl, NULL, 0, NULL, 0, &mime, 0); hres = FindMimeFromData(NULL, szUrl, NULL, 0, NULL, 0, &mime, 0);

View File

@ -402,6 +402,8 @@ static void test_its_protocol(void)
't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}; 't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0};
static const WCHAR blank_url3[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':', static const WCHAR blank_url3[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':',
't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}; 't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0};
static const WCHAR blank_url4[] = {'i','t','s',':',
't','e','s','t','.','c','h','m',':',':','b','l','a','n','k','.','h','t','m','l',0};
static const WCHAR wrong_url1[] = static const WCHAR wrong_url1[] =
{'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','.','h','t','m','l',0}; {'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','.','h','t','m','l',0};
static const WCHAR wrong_url2[] = static const WCHAR wrong_url2[] =
@ -446,6 +448,7 @@ static void test_its_protocol(void)
test_protocol_url(factory, blank_url1); test_protocol_url(factory, blank_url1);
test_protocol_url(factory, blank_url2); test_protocol_url(factory, blank_url2);
test_protocol_url(factory, blank_url3); test_protocol_url(factory, blank_url3);
test_protocol_url(factory, blank_url4);
} }
IClassFactory_Release(factory); IClassFactory_Release(factory);