diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-31 18:38:43 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-31 18:38:43 +0000 |
commit | 7e2b810519af0721cc68057f71c006a623e480cc (patch) | |
tree | 7ce26286b3f47c339e119269115da98cde59d897 /chrome | |
parent | d38c52673dae2b264545dcf1912eaf30b2600ec5 (diff) | |
download | chromium_src-7e2b810519af0721cc68057f71c006a623e480cc.zip chromium_src-7e2b810519af0721cc68057f71c006a623e480cc.tar.gz chromium_src-7e2b810519af0721cc68057f71c006a623e480cc.tar.bz2 |
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
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/download/download_util.cc | 6 |
1 files changed, 5 insertions, 1 deletions
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); } |