From 87c129c76857b322530fbff79b045c458f37dae5 Mon Sep 17 00:00:00 2001 From: simonasvaitkus <85103968+simonasvaitkus@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:44:49 +0200 Subject: [PATCH 1/3] Add decompression capability to SfnCall class. --- b_lambda_layer_common/util/sfn_call.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/b_lambda_layer_common/util/sfn_call.py b/b_lambda_layer_common/util/sfn_call.py index 643934a..7fcb53e 100644 --- a/b_lambda_layer_common/util/sfn_call.py +++ b/b_lambda_layer_common/util/sfn_call.py @@ -1,5 +1,6 @@ import json import uuid +import zlib from typing import Any, Dict, Optional, Union from json.decoder import JSONDecodeError @@ -39,6 +40,13 @@ def call(self, data: Dict[Any, Any]) -> Union[str, Dict[str, Any]]: ) output = json.loads(response.get('output', {})) + + # If the output is compressed, decompress it. + if output.get('compressed'): + compressed_value: str = output['value'] + + output = json.loads(zlib.decompress(bytes.fromhex(compressed_value))) + # Add http-like handling that does not break anything. output = self.__http_like_handling(output) From e2669d90f970ac1ac35bc35f9812dcb1d38c0679 Mon Sep 17 00:00:00 2001 From: simonasvaitkus <85103968+simonasvaitkus@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:46:16 +0200 Subject: [PATCH 2/3] Version bump. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a84947d..4404a17 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.5.0 +4.5.1 From 026991007826d9711fd81df5cf5d7d2a0c862bb5 Mon Sep 17 00:00:00 2001 From: simonasvaitkus <85103968+simonasvaitkus@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:09:18 +0200 Subject: [PATCH 3/3] Add minor changes. --- b_lambda_layer_common/util/sfn_call.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/b_lambda_layer_common/util/sfn_call.py b/b_lambda_layer_common/util/sfn_call.py index 7fcb53e..ae60026 100644 --- a/b_lambda_layer_common/util/sfn_call.py +++ b/b_lambda_layer_common/util/sfn_call.py @@ -41,15 +41,15 @@ def call(self, data: Dict[Any, Any]) -> Union[str, Dict[str, Any]]: output = json.loads(response.get('output', {})) + # Add http-like handling that does not break anything. + output = self.__http_like_handling(output) + # If the output is compressed, decompress it. if output.get('compressed'): compressed_value: str = output['value'] output = json.loads(zlib.decompress(bytes.fromhex(compressed_value))) - # Add http-like handling that does not break anything. - output = self.__http_like_handling(output) - return output @staticmethod