Skip to content

Commit dda2b2c

Browse files
committed
Revert "Code Quality: Handle malformed localized format strings in search header (#17735)"
This reverts commit 4bce02c.
1 parent 5a37637 commit dda2b2c

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/Files.App/ViewModels/ShellViewModel.cs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,25 +2736,9 @@ public async Task SearchAsync(FolderSearch search)
27362736
await ApplyFilesAndFoldersChangesAsync();
27372737
EmptyTextType = EmptyTextType.None;
27382738

2739-
if (!string.IsNullOrEmpty(search.Query))
2740-
{
2741-
try
2742-
{
2743-
// Try to format the localized string with the search query
2744-
SearchHeaderTitle = string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query);
2745-
}
2746-
catch (FormatException ex)
2747-
{
2748-
// Handle malformed localized format strings (e.g., incorrect placeholders in translation)
2749-
// Fallback to a safe default format
2750-
App.Logger.LogWarning(ex, "Malformed localized format string for SearchResultsFor. Using fallback format.");
2751-
SearchHeaderTitle = $"Search results for \"{search.Query}\"";
2752-
}
2753-
}
2754-
else
2755-
{
2756-
SearchHeaderTitle = string.Empty;
2757-
}
2739+
SearchHeaderTitle = !string.IsNullOrEmpty(search.Query)
2740+
? string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query)
2741+
: string.Empty;
27582742

27592743
if (SearchIconBitmapImage is null)
27602744
SearchIconBitmapImage ??= await UIHelpers.GetSearchIconResource();

0 commit comments

Comments
 (0)