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:
cbiesinger%web.de 2003-09-24 20:21:09 +00:00
parent d8575f0120
commit a67ce6b555

View File

@ -364,6 +364,7 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
nsIStreamListener ** aStreamListener)
{
nsCAutoString fileExtension;
nsresult rv;
// Get the file extension that we will need later
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
@ -396,7 +397,6 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
}
}
}
// If the method is post, don't bother getting the file extension;
// it will belong to a CGI script anyway
@ -406,7 +406,19 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
if (url) {
nsCAutoString query;
url->GetQuery(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);
// 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
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
if (!mimeInfo)
{
nsresult rv;
mimeInfo = do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv);
// If we still have no mime info, give up.
if (NS_FAILED(rv))