fix: remove extra dot in extension (#35618)
This commit is contained in:
parent
9f97c3e50a
commit
12a7d7eea5
1 changed files with 6 additions and 2 deletions
|
@ -99,14 +99,14 @@ bool GetRegistryDescriptionFromExtension(const std::string& file_ext,
|
||||||
// Set up a filter for a Save/Open dialog, |ext_desc| as the text descriptions
|
// 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'
|
// 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
|
// 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:
|
// created here are:
|
||||||
// 1. only files that have 'file_ext' as their extension
|
// 1. only files that have 'file_ext' as their extension
|
||||||
// 2. all files (only added if 'include_all_files' is true)
|
// 2. all files (only added if 'include_all_files' is true)
|
||||||
// If a description is not provided for a file extension, it will be retrieved
|
// 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
|
// 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").
|
// 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(
|
file_dialog::Filters FormatFilterForExtensions(
|
||||||
const std::vector<std::string>& file_ext,
|
const std::vector<std::string>& file_ext,
|
||||||
const std::vector<std::string>& ext_desc,
|
const std::vector<std::string>& ext_desc,
|
||||||
|
@ -168,6 +168,10 @@ file_dialog::Filters FormatFilterForExtensions(
|
||||||
base::ReplaceChars(desc, "*", base::StringPiece(), &desc);
|
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}});
|
result.push_back({desc, {ext}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue