From 4ad23e3a5953b9024fab7e2417b9a1a350c3ba92 Mon Sep 17 00:00:00 2001 From: Terri Cain Date: Mon, 27 May 2024 16:35:25 +0100 Subject: [PATCH] Fix upload file Processing callback --- aioboto3/s3/inject.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aioboto3/s3/inject.py b/aioboto3/s3/inject.py index c754501..1307d21 100644 --- a/aioboto3/s3/inject.py +++ b/aioboto3/s3/inject.py @@ -351,6 +351,8 @@ async def upload_fileobj( initial_data = Fileobj.read(Config.multipart_threshold) if inspect.isawaitable(initial_data): initial_data = await initial_data + if Processing: + initial_data = Processing(initial_data) if len(initial_data) < Config.multipart_threshold: # Do put_object @@ -360,6 +362,8 @@ async def upload_fileobj( Body=initial_data, **kwargs ) + if Callback: + Callback(len(initial_data)) return # File bigger than threshold, start multipart upload