From 78c819d2e67798ed4dcbb6f14a56841ed4a1e1ff Mon Sep 17 00:00:00 2001 From: jean-baptiste-perez-bib Date: Fri, 7 Jun 2024 21:20:23 +0200 Subject: [PATCH] Uses a generic form field name for payload upload This will facilitate a migration to a generic and API v2 compatible file upload code in the file service. --- app/api/v2/handlers/payload_api.py | 2 +- app/api/v2/schemas/payload_schemas.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/v2/handlers/payload_api.py b/app/api/v2/handlers/payload_api.py index 1ac01eae39..2d9a836a16 100644 --- a/app/api/v2/handlers/payload_api.py +++ b/app/api/v2/handlers/payload_api.py @@ -67,7 +67,7 @@ async def get_payloads(self, request: web.Request): async def post_payloads(self, request: web.Request): # As aiohttp_apispec.form_schema already calls request.multipart(), # accessing the file using the prefilled request["form"] dictionary. - field_field: web.FileField = request["form"]["payload"] + field_field: web.FileField = request["form"]["file"] file_name, file_path = await self.__generate_file_name_and_path(field_field) diff --git a/app/api/v2/schemas/payload_schemas.py b/app/api/v2/schemas/payload_schemas.py index e3939c15bb..99b8213e67 100644 --- a/app/api/v2/schemas/payload_schemas.py +++ b/app/api/v2/schemas/payload_schemas.py @@ -12,7 +12,7 @@ class PayloadSchema(schema.Schema): class PayloadCreateRequestSchema(schema.Schema): - payload = fields.Raw(type="file", required=True) + file = fields.Raw(type="file", required=True) class PayloadDeleteRequestSchema(schema.Schema):