diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 95f72476aa1..af1345b205d 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -731,9 +731,9 @@ void EditorFileDialog::update_file_name() { String base_name = file_str.get_basename(); Vector filter_substr = filter_str.split(";"); if (filter_substr.size() >= 2) { - file_str = base_name + "." + filter_substr[0].strip_edges().lstrip("*.").to_lower(); + file_str = base_name + "." + filter_substr[0].strip_edges().get_extension().to_lower(); } else { - file_str = base_name + "." + filter_str.get_extension().strip_edges().to_lower(); + file_str = base_name + "." + filter_str.strip_edges().get_extension().to_lower(); } file->set_text(file_str); } diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 73effa6c4b6..6bb4ac9c6f2 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -480,7 +480,12 @@ void FileDialog::update_file_name() { String filter_str = filters[idx]; String file_str = file->get_text(); String base_name = file_str.get_basename(); - file_str = base_name + "." + filter_str.strip_edges().to_lower(); + Vector filter_substr = filter_str.split(";"); + if (filter_substr.size() >= 2) { + file_str = base_name + "." + filter_substr[0].strip_edges().get_extension().to_lower(); + } else { + file_str = base_name + "." + filter_str.strip_edges().get_extension().to_lower(); + } file->set_text(file_str); } }