Browse Source

add query params to redirect

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

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