зеркало из https://github.com/mozilla/gecko-dev.git
143570 r=bzbarsky sr=darin
Allow assigning helper apps to mailnews attachments by extension. do this by only getting the query off the uri for HTTP/HTTPS urls - mailnews uris always have a query string, and if there is a query string the file extension is ignored because a CGI script is assumed, which has no useful extension.
This commit is contained in:
Родитель
d8575f0120
Коммит
a67ce6b555
|
@ -364,6 +364,7 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
|
||||||
nsIStreamListener ** aStreamListener)
|
nsIStreamListener ** aStreamListener)
|
||||||
{
|
{
|
||||||
nsCAutoString fileExtension;
|
nsCAutoString fileExtension;
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
// Get the file extension that we will need later
|
// Get the file extension that we will need later
|
||||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||||
|
@ -397,7 +398,6 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If the method is post, don't bother getting the file extension;
|
// If the method is post, don't bother getting the file extension;
|
||||||
// it will belong to a CGI script anyway
|
// it will belong to a CGI script anyway
|
||||||
// Also, if we already have an extension, don't bother
|
// Also, if we already have an extension, don't bother
|
||||||
|
@ -406,7 +406,19 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
nsCAutoString query;
|
nsCAutoString query;
|
||||||
|
|
||||||
|
// We only care about the query for HTTP and HTTPS URLs
|
||||||
|
PRBool isHTTP, isHTTPS;
|
||||||
|
rv = uri->SchemeIs("http", &isHTTP);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
isHTTP = PR_FALSE;
|
||||||
|
rv = uri->SchemeIs("https", &isHTTPS);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
isHTTPS = PR_FALSE;
|
||||||
|
|
||||||
|
if (isHTTP || isHTTPS)
|
||||||
url->GetQuery(query);
|
url->GetQuery(query);
|
||||||
|
|
||||||
// Only get the extension if the query is empty; if it isn't, then the
|
// Only get the extension if the query is empty; if it isn't, then the
|
||||||
// extension likely belongs to a cgi script and isn't helpful
|
// extension likely belongs to a cgi script and isn't helpful
|
||||||
if (query.IsEmpty())
|
if (query.IsEmpty())
|
||||||
|
@ -427,7 +439,6 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
|
||||||
// and create a new mime info object for it and use it
|
// and create a new mime info object for it and use it
|
||||||
if (!mimeInfo)
|
if (!mimeInfo)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
mimeInfo = do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv);
|
mimeInfo = do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv);
|
||||||
// If we still have no mime info, give up.
|
// If we still have no mime info, give up.
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче