diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-01 22:46:57 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-01 22:46:57 +0000 |
commit | 6d5e42bf7fd77cd05af2782390ca62ee53cfe64a (patch) | |
tree | de6866a8b356b5ad53361b664831d08348ed1d5d /chrome/common/win_util.cc | |
parent | 9e669be6fe03d5e7c76628ebf1f3e59e5dd5dc83 (diff) | |
download | chromium_src-6d5e42bf7fd77cd05af2782390ca62ee53cfe64a.zip chromium_src-6d5e42bf7fd77cd05af2782390ca62ee53cfe64a.tar.gz chromium_src-6d5e42bf7fd77cd05af2782390ca62ee53cfe64a.tar.bz2 |
Fix issue 4898: File extension wrong for saved files
When the user specifies a filename without an extension, such as "foo" instead of "foo.gif", we would append "gif" to the filename instead of ".gif" (so the user ends up with a file named "foogif").
I'm not confident this is the only thing wrong with this function. For example if the user specifies "foo." and the filter says "*.gif" shouldn't we add ".gif" to the filename instead of deleting the dot?
Also, we seem to be ignoring the default_extension parameter passed in when we figure out what extension to tack on and instead get the file extension from GetFileExtensionFromPath... :s
Review URL: http://codereview.chromium.org/12838
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6174 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/win_util.cc')
-rw-r--r-- | chrome/common/win_util.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/chrome/common/win_util.cc b/chrome/common/win_util.cc index aba3aad..676a0b8 100644 --- a/chrome/common/win_util.cc +++ b/chrome/common/win_util.cc @@ -434,6 +434,7 @@ bool SaveFileAsWithFilter(HWND owner, std::wstring file_ext = file_util::GetFileExtensionFromPath(suggested_name); if (save_as.nFileExtension == 0) { // No extension is specified. Append the default extension. + final_name->append(L"."); final_name->append(file_ext); } else if (save_as.nFileExtension == wcslen(save_as.lpstrFile)) { // The path ends with a ".". This is not supported on windows and since |