fix int_of_string on input
This commit is contained in:
parent
f8f4b9b110
commit
0208d62579
1 changed files with 9 additions and 7 deletions
|
|
@ -269,13 +269,15 @@ let profile_post request =
|
||||||
"Your display nick was updated!"
|
"Your display nick was updated!"
|
||||||
| Error e -> render_unsafe e request )
|
| Error e -> render_unsafe e request )
|
||||||
| `Ok [ ("content", content); ("count", count); ("label", label) ] -> (
|
| `Ok [ ("content", content); ("count", count); ("label", label) ] -> (
|
||||||
let count = int_of_string count in
|
match int_of_string_opt count with
|
||||||
match User.update_metadata count label content nick with
|
| None -> render_unsafe "Error: invalid count" request
|
||||||
| Ok () ->
|
| Some count -> (
|
||||||
Dream.respond ~status:`See_Other
|
match User.update_metadata count label content nick with
|
||||||
~headers:[ ("Location", "/profile") ]
|
| Ok () ->
|
||||||
"Your display nick was updated!"
|
Dream.respond ~status:`See_Other
|
||||||
| Error e -> render_unsafe e request )
|
~headers:[ ("Location", "/profile") ]
|
||||||
|
"Your display nick was updated!"
|
||||||
|
| Error e -> render_unsafe e request ) )
|
||||||
| `Ok _ | `Many_tokens _ | `Missing_token _ | `Invalid_token _
|
| `Ok _ | `Many_tokens _ | `Missing_token _ | `Invalid_token _
|
||||||
| `Wrong_session _ | `Expired _ | `Wrong_content_type -> (
|
| `Wrong_session _ | `Expired _ | `Wrong_content_type -> (
|
||||||
match%lwt Dream.multipart request with
|
match%lwt Dream.multipart request with
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue