bug 267475 Clicking links to JPEG file with Chinese name download the file instead of displaying it in browser r=cbie, sr=bz

This commit is contained in:
jshin%mailaps.org 2004-11-07 02:22:55 +00:00
Родитель fee7f4439e
Коммит da3ad9140c
2 изменённых файлов: 12 добавлений и 4 удалений

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

@ -394,10 +394,12 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
PRBool forceExternalHandling = PR_FALSE;
nsCAutoString disposition;
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(request));
nsCOMPtr<nsIURI> uri;
if (httpChannel)
{
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-disposition"),
disposition);
httpChannel->GetURI(getter_AddRefs(uri));
}
else
{
@ -415,10 +417,13 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar = do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
{
nsCAutoString fallbackCharset;
if (uri)
uri->GetOriginCharset(fallbackCharset);
nsAutoString dispToken;
// Get the disposition type
rv = mimehdrpar->GetParameter(disposition, "", EmptyCString(),
PR_FALSE, nsnull, dispToken);
rv = mimehdrpar->GetParameter(disposition, "", fallbackCharset,
PR_TRUE, nsnull, dispToken);
// RFC 2183, section 2.8 says that an unknown disposition
// value should be treated as "attachment"
if (NS_FAILED(rv) ||

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

@ -277,9 +277,12 @@ static PRBool GetFilenameAndExtensionFromChannel(nsIChannel* aChannel,
nsCOMPtr<nsIMIMEHeaderParam> mimehdrpar = do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv);
if (NS_FAILED(rv))
return PR_FALSE;
nsAutoString dispToken;
nsCAutoString fallbackCharset;
uri->GetOriginCharset(fallbackCharset);
// Get the disposition type
rv = mimehdrpar->GetParameter(disp, "", EmptyCString(), PR_FALSE,
nsAutoString dispToken;
rv = mimehdrpar->GetParameter(disp, "", fallbackCharset, PR_TRUE,
nsnull, dispToken);
// RFC 2183, section 2.8 says that an unknown disposition
// value should be treated as "attachment"