0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 04:08:54 +02:00

modules/media/download: Replace old stub with new stub involving magic::mime.

This commit is contained in:
Jason Volk 2018-02-21 17:46:24 -08:00
parent f235fc155e
commit ed96588155

View file

@ -49,23 +49,20 @@ handle_get(client &client,
request.parv[1] request.parv[1]
}; };
const fmt::snstringf path const std::string data
{ {
1024, //fs::read(file)
"/home/jason/.synapse/media_store/local_content/%s/%s/%s",
file.substr(0, 2),
file.substr(2, 2),
file.substr(4, file.size() - 4)
}; };
const auto data char mime_type_buf[64];
const string_view content_type
{ {
fs::read(path) magic::mime(mime_type_buf, string_view{data})
}; };
return resource::response return resource::response
{ {
client, string_view{data}, "image/jpg" client, string_view{data}, content_type
}; };
} }