summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 19:57:24 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-17 19:57:24 +0000
commit15bc8050874dd8108a222e17e99344afcbe99a55 (patch)
treedebfdefa16e4f4eb360f80f4e29461b0ec7f096f /chrome/browser/download
parent70a07ef6d9647d7b519638352cd17fa00ff22107 (diff)
downloadchromium_src-15bc8050874dd8108a222e17e99344afcbe99a55.zip
chromium_src-15bc8050874dd8108a222e17e99344afcbe99a55.tar.gz
chromium_src-15bc8050874dd8108a222e17e99344afcbe99a55.tar.bz2
Fixes saving files that don't have valid extensions.
Two fixes here. First was a disturbing discovery that FilePath::Extension returns an extension starting with a period. I am of the belief that this is the wrong API to expose, but that's a different fight. Fixed. Second is a subtle behavior of the old code that wasn't preserved. In the case where the extension did not exist in the registry, the old code dropped the extension from the filter. We now also do so. BUG=10561 Review URL: http://codereview.chromium.org/79045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r--chrome/browser/download/download_manager.cc2
-rw-r--r--chrome/browser/download/save_package.cc4
2 files changed, 5 insertions, 1 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 4e133e9..5a5649c 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -641,6 +641,8 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
SelectFileDialog::FileTypeInfo file_type_info;
file_type_info.extensions.resize(1);
file_type_info.extensions[0].push_back(info->suggested_path.Extension());
+ if (!file_type_info.extensions[0][0].empty())
+ file_type_info.extensions[0][0].erase(0, 1); // drop the .
file_type_info.include_all_files = true;
gfx::NativeWindow owning_window =
contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL;
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 0c40a82..3fc1738 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1021,6 +1021,8 @@ void SavePackage::GetSaveInfo() {
} else {
file_type_info.extensions.resize(1);
file_type_info.extensions[0].push_back(suggested_path.Extension());
+ if (!file_type_info.extensions[0][0].empty())
+ file_type_info.extensions[0][0].erase(0, 1); // drop the .
file_type_info.include_all_files = true;
file_type_index = 1;
}