mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 09:40:12 +01:00
modules/root: Supplement content-type/MIME-type with ircd::fs::magic interface.
This commit is contained in:
parent
f5197cc8ff
commit
092b4d3ace
1 changed files with 2 additions and 7 deletions
|
@ -49,6 +49,7 @@ get_root(client &client, const resource::request &request)
|
|||
rsplit(filename, '.').second
|
||||
};
|
||||
|
||||
char content_type_buf[64];
|
||||
string_view content_type; switch(hash(extension))
|
||||
{
|
||||
case hash("css"): content_type = "text/css; charset=utf-8"; break;
|
||||
|
@ -70,13 +71,7 @@ get_root(client &client, const resource::request &request)
|
|||
case hash("txt"): content_type = "text/plain; charset=utf-8"; break;
|
||||
default:
|
||||
{
|
||||
if(!empty(extension))
|
||||
log::warning
|
||||
{
|
||||
"Unknown mime type for extension '%s'", extension
|
||||
};
|
||||
|
||||
content_type = "application/octet-stream";
|
||||
content_type = fs::magic::mime(content_type_buf, string_view{content});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue