better if-not-match
This commit is contained in:
parent
28eb9fae55
commit
059c5d796f
7 changed files with 107 additions and 106 deletions
|
|
@ -21,10 +21,7 @@ module Assets_config = struct
|
|||
end
|
||||
|
||||
let etag k =
|
||||
let etag =
|
||||
match k with Terms -> Config.terms_etag | Privacy -> Config.privacy_etag
|
||||
in
|
||||
etag |> Headers_lib.Etag.of_crockford32 |> Result.get_ok
|
||||
match k with Terms -> Config.terms_etag | Privacy -> Config.privacy_etag
|
||||
|
||||
let legal_version = function
|
||||
| Terms -> Assets_config.terms_legal_version
|
||||
|
|
@ -50,7 +47,7 @@ let supported_lang_arr, supported_ext_arr =
|
|||
path_l
|
||||
in
|
||||
let lang_l = List.sort_uniq String.compare lang_l in
|
||||
let etag = Headers_lib.Etag.to_raw_string (etag t) in
|
||||
let etag = (etag t).value in
|
||||
List.iter
|
||||
(fun path ->
|
||||
let etag' = Fpath.to_string (Fpath.rem_ext (Fpath.base path)) in
|
||||
|
|
@ -162,10 +159,10 @@ end
|
|||
|
||||
(* ! 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 = Mimetype.to_extension_exn mime in
|
||||
let path =
|
||||
Fpath.to_string Fpath.((v (Assets_config.base_dir t) / lang / etag) + ext)
|
||||
Fpath.to_string
|
||||
Fpath.((v (Assets_config.base_dir t) / lang / (etag t).value) + ext)
|
||||
in
|
||||
match Assets_crunch.read path with
|
||||
| None -> Fmt.failwith "static file not found: `%s`" path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue