From f825336b39bde0bc2396f6d862aff8619c906f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Thu, 8 Aug 2024 16:07:13 +0200 Subject: [PATCH] Fix Chouette Valid client (#4121) The multipart upload was buggy. --- apps/transport/lib/validators/enroute_chouette_valid_client.ex | 2 +- .../validators/enroute_chouette_valid_client_test.exs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/transport/lib/validators/enroute_chouette_valid_client.ex b/apps/transport/lib/validators/enroute_chouette_valid_client.ex index 645dacf0ac..aeb9390ab9 100644 --- a/apps/transport/lib/validators/enroute_chouette_valid_client.ex +++ b/apps/transport/lib/validators/enroute_chouette_valid_client.ex @@ -57,7 +57,7 @@ defmodule Transport.EnRouteChouetteValidClient do end defp make_file_part(field_name, filepath) do - {field_name, filepath, {"form-data", [{:name, "file"}, {:filename, Path.basename(filepath)}]}, []} + {:file, filepath, {"form-data", [{:name, field_name}, {:filename, Path.basename(filepath)}]}, []} end defp validation_url(validation_id) do diff --git a/apps/transport/test/transport/validators/enroute_chouette_valid_client_test.exs b/apps/transport/test/transport/validators/enroute_chouette_valid_client_test.exs index 35746545ca..7132741bbf 100644 --- a/apps/transport/test/transport/validators/enroute_chouette_valid_client_test.exs +++ b/apps/transport/test/transport/validators/enroute_chouette_valid_client_test.exs @@ -31,8 +31,7 @@ defmodule Transport.EnRouteChouetteValidClientTest do assert [ {"validation[rule_set]", "french"}, - {"validation[file]", tmp_file, {"form-data", [{:name, "file"}, {:filename, Path.basename(tmp_file)}]}, - []} + {:file, tmp_file, {"form-data", [{:name, "validation[file]"}, {:filename, Path.basename(tmp_file)}]}, []} ] == parts %HTTPoison.Response{status_code: 201, body: response_body}