Compare commits

...

1 commit
main ... conan

Author SHA1 Message Date
9abcbed299 Use conan instead of magic-mime package 2022-11-09 15:20:00 +01:00
3 changed files with 10 additions and 2 deletions

View file

@ -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"

View file

@ -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 ())

View file

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