From 7e2b810519af0721cc68057f71c006a623e480cc Mon Sep 17 00:00:00 2001 From: "nsylvain@chromium.org" Date: Fri, 31 Oct 2008 18:38:43 +0000 Subject: Background: 1. We can tell chrome to "always open this type of file" when downloading. This is disabled for executable for security reasons. 2. When downloading an executable files we download a .download instead. -=-= The problem is that the "always open this type of file" is enabled for executables during the download because we check the extension of the file to know if it's an executable or not, and during download we see .download, and we don't consider it an executable. The fix is to look at the "original_name" when it's present to get the extension of the real file, not the .download. BUG:3814 Review URL: http://codereview.chromium.org/8918 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4306 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/download/download_util.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chrome') diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 7fab6f8..a166958 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -222,8 +222,12 @@ DownloadDestinationContextMenu::~DownloadDestinationContextMenu() { // Download opening ------------------------------------------------------------ bool CanOpenDownload(DownloadItem* download) { + std::wstring file_to_use = download->full_path(); + if (!download->original_name().empty()) + file_to_use = download->original_name(); + const std::wstring extension = - file_util::GetFileExtensionFromPath(download->full_path()); + file_util::GetFileExtensionFromPath(file_to_use); return !download->manager()->IsExecutable(extension); } -- cgit v1.1