Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/Files.App/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2736,9 +2736,25 @@ public async Task SearchAsync(FolderSearch search)
await ApplyFilesAndFoldersChangesAsync();
EmptyTextType = EmptyTextType.None;

SearchHeaderTitle = !string.IsNullOrEmpty(search.Query)
? string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query)
: string.Empty;
if (!string.IsNullOrEmpty(search.Query))
{
try
{
// Try to format the localized string with the search query
SearchHeaderTitle = string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query);
}
catch (FormatException ex)
{
// Handle malformed localized format strings (e.g., incorrect placeholders in translation)
// Fallback to a safe default format
App.Logger.LogWarning(ex, "Malformed localized format string for SearchResultsFor. Using fallback format.");
SearchHeaderTitle = $"Search results for \"{search.Query}\"";
}
}
else
{
SearchHeaderTitle = string.Empty;
}

if (SearchIconBitmapImage is null)
SearchIconBitmapImage ??= await UIHelpers.GetSearchIconResource();
Expand Down
Loading