mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibCore+Userland: Add more detectable types
More binary format detectors and descriptions
This commit is contained in:
parent
8b2706e5bb
commit
00de3b53c8
1 changed files with 9 additions and 1 deletions
|
@ -72,6 +72,12 @@ String guess_mime_type_based_on_filename(const StringView& path)
|
|||
return "text/markdown";
|
||||
if (path.ends_with(".html", CaseSensitivity::CaseInsensitive) || path.ends_with(".htm", CaseSensitivity::CaseInsensitive))
|
||||
return "text/html";
|
||||
if (path.ends_with(".js", CaseSensitivity::CaseInsensitive))
|
||||
return "application/javascript";
|
||||
if (path.ends_with(".json", CaseSensitivity::CaseInsensitive))
|
||||
return "application/json";
|
||||
if (path.ends_with(".md", CaseSensitivity::CaseInsensitive))
|
||||
return "text/markdown";
|
||||
if (path.ends_with("/", CaseSensitivity::CaseInsensitive))
|
||||
return "text/html";
|
||||
if (path.ends_with(".csv", CaseSensitivity::CaseInsensitive))
|
||||
|
@ -93,7 +99,9 @@ String guess_mime_type_based_on_filename(const StringView& path)
|
|||
__ENUMERATE_MIME_TYPE_HEADER(pgm, "image/x-portable-graymap", 3, 0x50, 0x32, 0x0A) \
|
||||
__ENUMERATE_MIME_TYPE_HEADER(png, "image/png", 8, 0x89, 'P', 'N', 'G', 0x0D, 0x0A, 0x1A, 0x0A) \
|
||||
__ENUMERATE_MIME_TYPE_HEADER(ppm, "image/x-portable-pixmap", 3, 0x50, 0x33, 0x0A) \
|
||||
__ENUMERATE_MIME_TYPE_HEADER(shell, "text/x-shellscript", 10, '#', '!', '/', 'b', 'i', 'n', '/', 's', 'h', '\n')
|
||||
__ENUMERATE_MIME_TYPE_HEADER(shell, "text/x-shellscript", 10, '#', '!', '/', 'b', 'i', 'n', '/', 's', 'h', '\n') \
|
||||
__ENUMERATE_MIME_TYPE_HEADER(tiff, "image/tiff", 4, 'I', 'I', '*', 0x00) \
|
||||
__ENUMERATE_MIME_TYPE_HEADER(tiff_bigendian, "image/tiff", 4, 'M', 'M', 0x00, '*')
|
||||
|
||||
#define __ENUMERATE_MIME_TYPE_HEADER(var_name, mime_type, pattern_size, ...) \
|
||||
static const u8 var_name##_arr[pattern_size] = { __VA_ARGS__ }; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue