From 011976de8908913d311b32183d560229fa9b03f2 Mon Sep 17 00:00:00 2001 From: Sky O Date: Fri, 29 Mar 2024 17:11:30 +0000 Subject: [PATCH] Add bad logic --- moto/moto_proxy/utils.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/moto/moto_proxy/utils.py b/moto/moto_proxy/utils.py index 23e98e27c..8b75eb571 100644 --- a/moto/moto_proxy/utils.py +++ b/moto/moto_proxy/utils.py @@ -87,10 +87,18 @@ def get_body_from_form_data( data = None headers: Dict[str, str] = {} - # for part in parts: - # for header in part.headers: - # if header.key + for part in parts: + for header in part.headers: + if 'name="upload_file"' in header.value: + headers["key"] = "upload_file" + data = part.data + else: + if 'name="file"' in header.value: + data = part.data + else: + headers["file"] = part.data.decode("utf-8") +# name="x-amz-algorithm"', b'Content-Disposition':b'form-data; name="x-amz-credential"', b'Content-Disposition':b'form-data; name="x-amz-date"', b'Content-Disposition':b'form-data; name="policy"', b'Content-Disposition':b'form-data; name="x-amz-signature"', b'Content-Disposition':b'form-data; name="file"; filename="/run/user/1001/tmpi1gf2n_j/test_local_file.txt"'], # for prt in parser.parts(): # if prt.name == "upload_file": # headers["key"] = prt.name