pretty_retrieve: use match_filname to match MIME

fixes pastes which had JSON, Bash, etc. content.

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain 2021-01-06 10:00:49 +05:30
parent d3106f3fce
commit 651f3d8157

View File

@ -35,7 +35,7 @@ fn pretty_retrieve(id: PasteId) -> Option<Template> {
map.insert("code", contents);
let rendered = Template::render("pretty", &map);
match tree_magic::from_filepath(filepath).contains("text") {
match tree_magic::match_filepath("text/plain", filepath) {
true => Some(rendered),
false => None
}