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}
|
"alcotest" {with-test}
|
||||||
"ppx_deriving" {with-test}
|
"ppx_deriving" {with-test}
|
||||||
"ppx_deriving_yojson" {with-test}
|
"ppx_deriving_yojson" {with-test}
|
||||||
|
"conan-unix" {>= "0.0.2"}
|
||||||
|
"conan-database" {>= "0.0.2"}
|
||||||
]
|
]
|
||||||
|
|
||||||
synopsis: "Web interface for builder"
|
synopsis: "Web interface for builder"
|
||||||
|
|
|
@ -60,12 +60,16 @@ let mime_lookup path =
|
||||||
(match Fpath.to_string path with
|
(match Fpath.to_string path with
|
||||||
| "build-environment" | "opam-switch" | "system-packages" ->
|
| "build-environment" | "opam-switch" | "system-packages" ->
|
||||||
"text/plain"
|
"text/plain"
|
||||||
| _ ->
|
| filename ->
|
||||||
if Fpath.has_ext "build-hashes" path
|
if Fpath.has_ext "build-hashes" path
|
||||||
then "text/plain"
|
then "text/plain"
|
||||||
else if Fpath.is_prefix Fpath.(v "bin/") path
|
else if Fpath.is_prefix Fpath.(v "bin/") path
|
||||||
then "application/octet-stream"
|
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 =
|
let string_of_html =
|
||||||
Format.asprintf "%a" (Tyxml.Html.pp ())
|
Format.asprintf "%a" (Tyxml.Html.pp ())
|
||||||
|
|
2
lib/dune
2
lib/dune
|
@ -18,4 +18,6 @@
|
||||||
decompress.de
|
decompress.de
|
||||||
decompress.gz
|
decompress.gz
|
||||||
uri
|
uri
|
||||||
|
conan-unix
|
||||||
|
conan-database
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue