1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibCore: Replace MIME type description lookup with a more generic method

Rather than adding a bunch of `get_*_from_mime_type` functions, add just
one to get the Core::MimeType instance. We will need multiple fields at
once in Browser.
This commit is contained in:
Timothy Flynn 2024-03-14 19:15:40 -04:00 committed by Andreas Kling
parent 6760d236e4
commit 1f44c9468a
3 changed files with 8 additions and 8 deletions

View file

@ -168,14 +168,14 @@ Optional<StringView> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes)
return {};
}
Optional<StringView> get_description_from_mime_type(StringView mime_name)
Optional<MimeType const&> get_mime_type_data(StringView mime_name)
{
for (auto const& mime_type : s_registered_mime_type) {
if (mime_name == mime_type.name)
return mime_type.description;
return mime_type;
}
return OptionalNone {};
return {};
}
Optional<StringView> guess_mime_type_based_on_sniffed_bytes(Core::File& file)