Use conan instead of magic-mime package
This commit is contained in:
parent
a355b6124d
commit
9abcbed299
3 changed files with 10 additions and 2 deletions
|
@ -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"
|
||||
|
|
|
@ -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 ())
|
||||
|
|
2
lib/dune
2
lib/dune
|
@ -18,4 +18,6 @@
|
|||
decompress.de
|
||||
decompress.gz
|
||||
uri
|
||||
conan-unix
|
||||
conan-database
|
||||
))
|
||||
|
|
Loading…
Reference in a new issue