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
Родитель d8575f0120
Коммит a67ce6b555
1 изменённых файлов: 14 добавлений и 3 удалений

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

@ -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))