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

LibCore: Share the mime-type list between the two detection methods

We used to have two separate lists for mime-type detection, one for
detection based on the file extension, and the other one for detection
based on byte sniffing.

This list also contains a general description that will be of use in
`file.cpp`.

To create this list, I had to fill in some gaps as the two lists started
to diverge.
This commit is contained in:
Lucas CHOLLET 2023-07-11 19:00:23 -04:00 committed by Sam Atkins
parent e3f65f215d
commit c543a13835
2 changed files with 95 additions and 136 deletions

View file

@ -53,4 +53,12 @@ StringView guess_mime_type_based_on_filename(StringView);
Optional<StringView> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes);
Optional<StringView> guess_mime_type_based_on_sniffed_bytes(Core::File&);
struct MimeType {
StringView name {};
Vector<StringView> common_extensions {};
StringView description {};
Optional<Vector<u8>> magic_bytes {};
u64 offset { 0 };
};
}