diff --git a/browser/components/feeds/src/nsFeedSniffer.cpp b/browser/components/feeds/src/nsFeedSniffer.cpp index ddca03edac4..19aa0fb2f01 100644 --- a/browser/components/feeds/src/nsFeedSniffer.cpp +++ b/browser/components/feeds/src/nsFeedSniffer.cpp @@ -161,17 +161,14 @@ HasAttachmentDisposition(nsIHttpChannel* httpChannel) // XXXbz this code is duplicated in GetFilenameAndExtensionFromChannel in // nsExternalHelperAppService. Factor it out! if (NS_FAILED(rv) || - (// Some broken sites just send - // Content-Disposition: ; filename="file" - // screen those out here. - !dispToken.IsEmpty() && + (!dispToken.IsEmpty() && !StringBeginsWithLowercaseLiteral(dispToken, "inline") && // Broken sites just send // Content-Disposition: filename="file" // without a disposition token... screen those out. - !StringBeginsWithLowercaseLiteral(dispToken, "filename")) && - // Also in use is Content-Disposition: name="file" - !StringBeginsWithLowercaseLiteral(dispToken, "name")) + !StringBeginsWithLowercaseLiteral(dispToken, "filename") && + // Also in use is Content-Disposition: name="file" + !StringBeginsWithLowercaseLiteral(dispToken, "name"))) // We have a content-disposition of "attachment" or unknown return PR_TRUE; } diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index f1ba4625286..770bcaac25b 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -402,17 +402,14 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports * // XXXbz this code is duplicated in GetFilenameAndExtensionFromChannel in // nsExternalHelperAppService. Factor it out! if (NS_FAILED(rv) || - (// Some broken sites just send - // Content-Disposition: ; filename="file" - // screen those out here. - !dispToken.IsEmpty() && + (!dispToken.IsEmpty() && !dispToken.LowerCaseEqualsLiteral("inline") && - // Broken sites just send - // Content-Disposition: filename="file" - // without a disposition token... screen those out. - !dispToken.EqualsIgnoreCase("filename", 8)) && - // Also in use is Content-Disposition: name="file" - !dispToken.EqualsIgnoreCase("name", 4)) + // Broken sites just send + // Content-Disposition: filename="file" + // without a disposition token... screen those out. + !dispToken.EqualsIgnoreCase("filename", 8) && + // Also in use is Content-Disposition: name="file" + !dispToken.EqualsIgnoreCase("name", 4))) // We have a content-disposition of "attachment" or unknown forceExternalHandling = PR_TRUE; } diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index cb5fc87cf4e..1a07f2d849e 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -316,17 +316,14 @@ static PRBool GetFilenameAndExtensionFromChannel(nsIChannel* aChannel, // XXXbz this code is duplicated in nsDocumentOpenInfo::DispatchContent. // Factor it out! Maybe store it in the nsDocumentOpenInfo? if (NS_FAILED(rv) || - (// Some broken sites just send - // Content-Disposition: ; filename="file" - // screen those out here. - !dispToken.IsEmpty() && + (!dispToken.IsEmpty() && !dispToken.LowerCaseEqualsLiteral("inline") && - // Broken sites just send - // Content-Disposition: filename="file" - // without a disposition token... screen those out. - !dispToken.EqualsIgnoreCase("filename", 8)) && - // Also in use is Content-Disposition: name="file" - !dispToken.EqualsIgnoreCase("name", 4)) + // Broken sites just send + // Content-Disposition: filename="file" + // without a disposition token... screen those out. + !dispToken.EqualsIgnoreCase("filename", 8) && + // Also in use is Content-Disposition: name="file" + !dispToken.EqualsIgnoreCase("name", 4))) { // We have a content-disposition of "attachment" or unknown handleExternally = PR_TRUE;