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