mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 19:16:02 +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:
parent
e3f65f215d
commit
c543a13835
Notes:
sideshowbarker
2024-07-17 02:35:27 +09:00
Author: https://github.com/LucasChollet
Commit: c543a13835
Pull-request: https://github.com/SerenityOS/serenity/pull/19957
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/MacDue
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/vkoskiv
2 changed files with 95 additions and 136 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue