add headers_lib
This commit is contained in:
parent
72426790b4
commit
4cbf3c722c
6 changed files with 110 additions and 92 deletions
|
|
@ -102,12 +102,13 @@ let is_supported_mimetype mime = Array.mem mime supported_mimetype_arr
|
|||
|
||||
(* ! lang and mime must be supported *)
|
||||
let get_content ~lang ~mime t =
|
||||
let etag = Headers_lib.Etag.to_raw_string (etag t) in
|
||||
let ext =
|
||||
match Util.mimetype_to_extension mime with
|
||||
| None -> Fmt.failwith "mimetype `%s/%s` unknown" (fst mime) (snd mime)
|
||||
| Some ext -> ext
|
||||
in
|
||||
let path = Fpath.to_string Fpath.((base_dir t / lang / etag t) + ext) in
|
||||
let path = Fpath.to_string Fpath.((base_dir t / lang / etag) + ext) in
|
||||
match Assets_crunch.read path with
|
||||
| None -> Fmt.failwith "static file not found: `%s`" path
|
||||
| Some data -> data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue