Unescape URLs in mail subjects before passing them to ShellExecute. Bug 227268, r=bsmedberg, sr=biesi

This commit is contained in:
Simon Montagu 2012-02-25 23:12:55 -08:00
Родитель 8c1a438588
Коммит fd4c554739
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -55,6 +55,7 @@
#include "nsIProcess.h"
#include "nsOSHelperAppService.h"
#include "nsUnicharUtils.h"
#include "nsITextToSubURI.h"
#define RUNDLL32_EXE L"\\rundll32.exe"
@ -266,6 +267,18 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
// extract the url spec from the url
nsCAutoString urlSpec;
aURL->GetAsciiSpec(urlSpec);
// Unescape non-ASCII characters in the URL
nsCAutoString urlCharset;
nsAutoString utf16Spec;
rv = aURL->GetOriginCharset(urlCharset);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITextToSubURI> textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = textToSubURI->UnEscapeNonAsciiURI(urlCharset, urlSpec, utf16Spec);
NS_ENSURE_SUCCESS(rv, rv);
static const PRUnichar cmdVerb[] = L"open";
SHELLEXECUTEINFOW sinfo;
@ -281,8 +294,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
SFGAOF sfgao;
// Bug 394974
if (SUCCEEDED(SHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(),
NULL, &pidl, 0, &sfgao))) {
if (SUCCEEDED(SHParseDisplayName(utf16Spec.get(),NULL, &pidl, 0, &sfgao))) {
sinfo.lpIDList = pidl;
sinfo.fMask |= SEE_MASK_INVOKEIDLIST;
} else {