add query params to redirect

pull/104/head
Hannes Mehnert 10 months ago
parent 4c3a5986d6
commit 3bee8a357d
  1. 9
      lib/builder_web.ml

@ -477,13 +477,18 @@ let add_routes datadir configdir =
in
let redirect_parent req =
let path = Dream.target req in
let parent =
Dream.target req |>
String.split_on_char '/' |>
List.rev |> List.tl |> List.rev |>
String.concat "/"
in
Dream.redirect ~status:`Temporary_Redirect req (parent ^ "/")
let parent = parent ^ "/" in
let url = match Dream.queries req with
| [] -> parent
| xs -> parent ^ (Dream.to_form_urlencoded xs)
in
Dream.redirect ~status:`Temporary_Redirect req url
in
let w f req = or_error_response (f req) in

Loading…
Cancel
Save