From 0369de541ca31d455b577a66b98dd800957dc8ad Mon Sep 17 00:00:00 2001 From: Swrup Date: Sat, 29 Jan 2022 10:11:36 +0100 Subject: [PATCH] remove duplicate when matching multipart form --- src/permap.ml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/permap.ml b/src/permap.ml index e4cbd81..f9fa670 100644 --- a/src/permap.ml +++ b/src/permap.ml @@ -166,7 +166,6 @@ let newthread_post ~board request = | None -> render_unsafe "Not logged in" request | Some nick -> ( match%lwt Dream.multipart request with - (*TODO jpp du duplicat la *) | `Ok [ ("alt", [ (_, alt) ]) ; ("file", file) @@ -175,15 +174,7 @@ let newthread_post ~board request = ; ("subject", [ (_, subject) ]) ; ("tags", [ (_, tags) ]) ; ("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 | None, _ -> render_unsafe "Invalide coordinate" request | _, None -> render_unsafe "Invalide coordinate" request @@ -241,12 +232,7 @@ let reply_post request = ; ("file", file) ; ("replyComment", [ (_, comment) ]) ; ("tags", [ (_, tags) ]) - ] - | `Ok - (("alt", [ (_, alt) ]) - :: ("file", file) - :: ("tags", [ (_, tags) ]) - :: ("replyComment", [ (_, comment) ]) :: _ :: _ ) -> ( + ] -> ( let parent_id = Dream.param "thread_id" request in let res = match file with