remove duplicate when matching multipart form

This commit is contained in:
Swrup 2022-01-29 10:11:36 +01:00
parent 8f5322a645
commit 0369de541c

View file

@ -166,7 +166,6 @@ let newthread_post ~board request =
| None -> render_unsafe "Not logged in" request | None -> render_unsafe "Not logged in" request
| Some nick -> ( | Some nick -> (
match%lwt Dream.multipart request with match%lwt Dream.multipart request with
(*TODO jpp du duplicat la *)
| `Ok | `Ok
[ ("alt", [ (_, alt) ]) [ ("alt", [ (_, alt) ])
; ("file", file) ; ("file", file)
@ -175,15 +174,7 @@ let newthread_post ~board request =
; ("subject", [ (_, subject) ]) ; ("subject", [ (_, subject) ])
; ("tags", [ (_, tags) ]) ; ("tags", [ (_, tags) ])
; ("threadComment", [ (_, comment) ]) ; ("threadComment", [ (_, comment) ])
] ] -> (
| `Ok
(("alt", [ (_, alt) ])
:: ("file", file)
:: ("lat_input", [ (_, lat) ])
:: ("lng_input", [ (_, lng) ])
:: ("subject", [ (_, subject) ])
:: ("tags", [ (_, tags) ])
:: ("threadComment", [ (_, comment) ]) :: _ :: _ ) -> (
match (Float.of_string_opt lat, Float.of_string_opt lng) with match (Float.of_string_opt lat, Float.of_string_opt lng) with
| None, _ -> render_unsafe "Invalide coordinate" request | None, _ -> render_unsafe "Invalide coordinate" request
| _, None -> render_unsafe "Invalide coordinate" request | _, None -> render_unsafe "Invalide coordinate" request
@ -241,12 +232,7 @@ let reply_post request =
; ("file", file) ; ("file", file)
; ("replyComment", [ (_, comment) ]) ; ("replyComment", [ (_, comment) ])
; ("tags", [ (_, tags) ]) ; ("tags", [ (_, tags) ])
] ] -> (
| `Ok
(("alt", [ (_, alt) ])
:: ("file", file)
:: ("tags", [ (_, tags) ])
:: ("replyComment", [ (_, comment) ]) :: _ :: _ ) -> (
let parent_id = Dream.param "thread_id" request in let parent_id = Dream.param "thread_id" request in
let res = let res =
match file with match file with