From 48fdfef82215b9fe6e941d472879a1ab87429a17 Mon Sep 17 00:00:00 2001 From: "joshmoz%gmail.com" Date: Sat, 5 Mar 2005 18:34:12 +0000 Subject: [PATCH] fix "Download Link Target" results in bad download for large MP3 file. b=281648 sr=pinkerton git-svn-id: svn://10.0.0.236/trunk@170215 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/camino/src/download/SaveHeaderSniffer.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mozilla/camino/src/download/SaveHeaderSniffer.mm b/mozilla/camino/src/download/SaveHeaderSniffer.mm index 32103b7688e..9b11afbb68b 100644 --- a/mozilla/camino/src/download/SaveHeaderSniffer.mm +++ b/mozilla/camino/src/download/SaveHeaderSniffer.mm @@ -55,6 +55,8 @@ #include "nsIDOMHTMLDocument.h" #include "nsIMIMEHeaderParam.h" #include "nsIDownload.h" +#include "nsIExternalHelperAppService.h" +#include "nsCExternalHandlerService.h" const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1"; @@ -107,6 +109,8 @@ nsHeaderSniffer::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aReques httpChannel->GetResponseHeader(nsCAutoString("content-disposition"), mContentDisposition); mPersist->CancelSave(); + mPersist = nsnull; + PRBool exists; mTmpFile->Exists(&exists); if (exists) @@ -374,8 +378,8 @@ nsresult nsHeaderSniffer::InitiateDownload(nsISupports* inSourceData, nsString& webPersist->SetPersistFlags(flags); if (sourceURI) - { // Tell web persist we want no decoding on this data - flags |= nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION; + { + flags |= nsIWebBrowserPersist::PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION; webPersist->SetPersistFlags(flags); rv = webPersist->SaveURI(sourceURI, nsnull, nsnull, mPostData, nsnull, destURI); }