diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-23 23:53:14 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-23 23:53:14 +0000 |
commit | 2001fe88673d7b232014bf801b17ee9f4dff52ed (patch) | |
tree | 531f14a5433a020981ea6e0a58379a49ec04ca01 /chrome/browser/download/download_manager.cc | |
parent | 2a490dadb7a0c9b85d3729e6caee6096482477e9 (diff) | |
download | chromium_src-2001fe88673d7b232014bf801b17ee9f4dff52ed.zip chromium_src-2001fe88673d7b232014bf801b17ee9f4dff52ed.tar.gz chromium_src-2001fe88673d7b232014bf801b17ee9f4dff52ed.tar.bz2 |
Fix a download regression.
FilePath::Extension() returns ".extension" whereas file_util::GetExtensionFromFilename() returns just "extension"
Review URL: http://codereview.chromium.org/27071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_manager.cc')
-rw-r--r-- | chrome/browser/download/download_manager.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 275b385..85b8447 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -822,7 +822,10 @@ void DownloadManager::ContinueDownloadFinished(DownloadItem* download) { download->UpdateObservers(); // Open the download if the user or user prefs indicate it should be. - const FilePath::StringType extension = download->full_path().Extension(); + FilePath::StringType extension = download->full_path().Extension(); + // Drop the leading period. + if (extension.size() > 0) + extension = extension.substr(1); if (download->open_when_complete() || ShouldOpenFileExtension(extension)) OpenDownloadInShell(download, NULL); } @@ -959,7 +962,11 @@ void DownloadManager::OnPauseDownloadRequest(ResourceDispatcherHost* rdh, bool DownloadManager::IsDangerous(const FilePath& file_name) { // TODO(jcampan): Improve me. - return IsExecutable(file_name.Extension()); + FilePath::StringType extension = file_name.Extension(); + // Drop the leading period. + if (extension.size() > 0) + extension = extension.substr(1); + return IsExecutable(extension); } void DownloadManager::RenameDownload(DownloadItem* download, @@ -1259,9 +1266,7 @@ void DownloadManager::SaveAutoOpens() { #if defined(OS_WIN) extensions_w = extensions; #elif defined(OS_POSIX) - // TODO(port): this is not correct since FilePath::StringType is not - // necessarily UTF8. - extensions_w = UTF8ToWide(extensions); + extensions_w = SysNativeMBToWide(extensions); #endif prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions_w); |