From 0e278fecdf141cae372fdda9fdea10b226dee622 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 13 Oct 2022 20:33:12 +0000 Subject: [PATCH 1/2] fix: remove extra period of extension Co-authored-by: mlaurencin --- shell/browser/electron_download_manager_delegate.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/browser/electron_download_manager_delegate.cc b/shell/browser/electron_download_manager_delegate.cc index e2a0c8896c547..d792d91ea90a2 100644 --- a/shell/browser/electron_download_manager_delegate.cc +++ b/shell/browser/electron_download_manager_delegate.cc @@ -99,7 +99,7 @@ bool GetRegistryDescriptionFromExtension(const std::string& file_ext, // Set up a filter for a Save/Open dialog, |ext_desc| as the text descriptions // of the |file_ext| types (optional), and (optionally) the default 'All Files' // view. The purpose of the filter is to show only files of a particular type in -// a Windows Save/Open dialog box. The resulting filter is returned. The filter +// a Windows Save/Open dialog box. The resulting filter is returned. The filters // created here are: // 1. only files that have 'file_ext' as their extension // 2. all files (only added if 'include_all_files' is true) @@ -168,6 +168,10 @@ file_dialog::Filters FormatFilterForExtensions( base::ReplaceChars(desc, "*", base::StringPiece(), &desc); } + // Remove the preceeding '.' character from the extension. + size_t ext_index = ext.find_first_not_of('.'); + if (ext_index != std::string::npos) + ext = ext.substr(ext_index); result.push_back({desc, {ext}}); } From e7b9feb8deeca2829b900ca162c6a0b7fc7da034 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 13 Oct 2022 20:33:14 +0000 Subject: [PATCH 2/2] update comment Co-authored-by: mlaurencin --- shell/browser/electron_download_manager_delegate.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/electron_download_manager_delegate.cc b/shell/browser/electron_download_manager_delegate.cc index d792d91ea90a2..88fcc373c3383 100644 --- a/shell/browser/electron_download_manager_delegate.cc +++ b/shell/browser/electron_download_manager_delegate.cc @@ -106,7 +106,7 @@ bool GetRegistryDescriptionFromExtension(const std::string& file_ext, // If a description is not provided for a file extension, it will be retrieved // from the registry. If the file extension does not exist in the registry, a // default description will be created (e.g. "qqq" yields "QQQ File"). -// Copied from ui/shell_dialogs/select_file_dialog_win.cc +// Modified from ui/shell_dialogs/select_file_dialog_win.cc file_dialog::Filters FormatFilterForExtensions( const std::vector& file_ext, const std::vector& ext_desc,