mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:48:13 +00:00
file: Use the mime-type description provided by LibCore
This allows us to get rid of another mime-type list in the codebase. To do so, the `get_description_from_mime_type` function is introduced in this patch.
This commit is contained in:
parent
c543a13835
commit
15bd708cfd
3 changed files with 35 additions and 57 deletions
|
@ -166,6 +166,16 @@ Optional<StringView> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes)
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<StringView> get_description_from_mime_type(StringView mime_name)
|
||||
{
|
||||
for (auto const& mime_type : s_registered_mime_type) {
|
||||
if (mime_name == mime_type.name)
|
||||
return mime_type.description;
|
||||
}
|
||||
|
||||
return OptionalNone {};
|
||||
}
|
||||
|
||||
Optional<StringView> guess_mime_type_based_on_sniffed_bytes(Core::File& file)
|
||||
{
|
||||
// Read accounts for longest possible offset + signature we currently match against (extra/iso-9660)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue