merge with upstream
This commit is contained in:
commit
6488fea2a4
@ -1,5 +1,8 @@
|
|||||||
open Opium.Std
|
open Opium.Std
|
||||||
|
|
||||||
|
let sanitised_path path =
|
||||||
|
let parent = Str.regexp "\.\./" in
|
||||||
|
Str.global_replace parent "" path
|
||||||
|
|
||||||
let print_css =
|
let print_css =
|
||||||
get "/style.css"
|
get "/style.css"
|
||||||
@ -10,7 +13,7 @@ let print_css =
|
|||||||
let print_ymd =
|
let print_ymd =
|
||||||
get "/:title"
|
get "/:title"
|
||||||
begin fun req ->
|
begin fun req ->
|
||||||
let filename = String.map (fun c -> if '/' = c then '_' else c) (param req "title") in
|
let filename = sanitised_path (param req "title") in
|
||||||
let filepath = "ymd/" ^ filename ^ ".ymd" in
|
let filepath = "ymd/" ^ filename ^ ".ymd" in
|
||||||
`Html (Html.html_of (Logarion.ymd filepath)) |> respond'
|
`Html (Html.html_of (Logarion.ymd filepath)) |> respond'
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user