From cdf3559b275b426a0bf4b897f1867c4df79a4a80 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 26 Jan 2024 18:19:16 -0500 Subject: [PATCH] Storage Kit: Do case conversion in SupportingApps::{Get,Set}SupportedTypes. We already convert everything to lowercase in BuildSupportingAppsTable(), so we should do the same here. Fixes #18752 (again.) --- src/kits/storage/mime/SupportingApps.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/kits/storage/mime/SupportingApps.cpp b/src/kits/storage/mime/SupportingApps.cpp index e8c286b225..53ab3a4f76 100644 --- a/src/kits/storage/mime/SupportingApps.cpp +++ b/src/kits/storage/mime/SupportingApps.cpp @@ -76,6 +76,9 @@ SupportingApps::GetSupportingApps(const char *type, BMessage *apps) // Clear the message, as we're just going to add to it apps->MakeEmpty(); + BString typeString(type); + typeString.ToLower(); + BMimeType mime(type); status_t status = mime.InitCheck(); if (status != B_OK) @@ -83,7 +86,7 @@ SupportingApps::GetSupportingApps(const char *type, BMessage *apps) if (mime.IsSupertypeOnly()) { // Add the apps that support this supertype (plus their count) - std::set &superApps = fSupportingApps[type]; + std::set &superApps = fSupportingApps[typeString.String()]; int32 count = 0; std::set::const_iterator i; for (i = superApps.begin(); i != superApps.end() && status == B_OK; i++) { @@ -94,7 +97,7 @@ SupportingApps::GetSupportingApps(const char *type, BMessage *apps) status = apps->AddInt32(kSupportingAppsSuperCountField, count); } else { // Add the apps that support this subtype (plus their count) - std::set &subApps = fSupportingApps[type]; + std::set &subApps = fSupportingApps[typeString.String()]; int32 count = 0; std::set::const_iterator i; for (i = subApps.begin(); i != subApps.end() && status == B_OK; i++) { @@ -177,10 +180,11 @@ SupportingApps::SetSupportedTypes(const char *app, const BMessage *types, bool f // supported types list and adding the app as a supporting app for // each type. newTypes.clear(); - const char *type; + BString type; for (int32 i = 0; types->FindString(kTypesField, i, &type) == B_OK; i++) { - newTypes.insert(type); - AddSupportingApp(type, app); + type.ToLower(); + newTypes.insert(type.String()); + AddSupportingApp(type.String(), app); } // Update the list of stranded types by removing any types that are newly