Use conan instead of magic-mime package

This commit is contained in:
Romain Calascibetta 2022-06-24 17:42:03 +02:00 committed by Reynir Björnsson
parent a355b6124d
commit 9abcbed299
3 changed files with 10 additions and 2 deletions

View file

@ -53,6 +53,8 @@ depends: [
"alcotest" {with-test}
"ppx_deriving" {with-test}
"ppx_deriving_yojson" {with-test}
"conan-unix" {>= "0.0.2"}
"conan-database" {>= "0.0.2"}
]
synopsis: "Web interface for builder"

View file

@ -60,12 +60,16 @@ let mime_lookup path =
(match Fpath.to_string path with
| "build-environment" | "opam-switch" | "system-packages" ->
"text/plain"
| _ ->
| filename ->
if Fpath.has_ext "build-hashes" path
then "text/plain"
else if Fpath.is_prefix Fpath.(v "bin/") path
then "application/octet-stream"
else Magic_mime.lookup (Fpath.to_string path))
else match Option.bind
(Result.to_option (Conan_unix.run_with_tree Conan_magic_database.tree filename))
Conan.Metadata.mime with
| Some mime_type -> mime_type
| None -> "application/octet-stream" (* default *))
let string_of_html =
Format.asprintf "%a" (Tyxml.Html.pp ())

View file

@ -18,4 +18,6 @@
decompress.de
decompress.gz
uri
conan-unix
conan-database
))