summaryrefslogtreecommitdiffstats
path: root/chrome/common/win_util.cc
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/common/win_util.cc
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/common/win_util.cc')
-rw-r--r--chrome/common/win_util.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/common/win_util.cc b/chrome/common/win_util.cc
index 692aeca..480355b 100644
--- a/chrome/common/win_util.cc
+++ b/chrome/common/win_util.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.
@@ -250,7 +250,12 @@ std::wstring FormatFilterForExtensions(
size_t first_separator_index = first_extension.find(L';');
if (first_separator_index != std::wstring::npos)
first_extension = first_extension.substr(0, first_separator_index);
- GetRegistryDescriptionFromExtension(first_extension, &desc);
+ if (!GetRegistryDescriptionFromExtension(first_extension, &desc)) {
+ // The extension doesn't exist in the registry. It's likely bogus, so
+ // just drop it.
+ include_all_files = true;
+ continue;
+ }
if (desc.empty())
desc = L"*." + first_extension;
}