add query params to redirect
This commit is contained in:
parent
4c3a5986d6
commit
3bee8a357d
1 changed files with 7 additions and 2 deletions
|
@ -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…
Reference in a new issue