From ae680387c54252f546930e1b076d67bf8143da8e Mon Sep 17 00:00:00 2001 From: Jan Gassen Date: Wed, 28 Aug 2024 11:17:43 +0200 Subject: [PATCH] Fix signature containing boolean values True in python was converted to "True" in signature calculation. JSON serialisation however converted it to "true", which resulted in invalid signatures being calculated. --- cloudinary/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cloudinary/utils.py b/cloudinary/utils.py index 297bdb7..a6f8d93 100644 --- a/cloudinary/utils.py +++ b/cloudinary/utils.py @@ -628,7 +628,11 @@ def sign_request(params, options): def api_sign_request(params_to_sign, api_secret, algorithm=SIGNATURE_SHA1): - params = [(k + "=" + (",".join(v) if isinstance(v, list) else str(v))) for k, v in params_to_sign.items() if v] + params = [(k + "=" + ( + ",".join(v) if isinstance(v, list) else + str(v).lower() if isinstance(v, bool) else + str(v) + )) for k, v in params_to_sign.items() if v] to_sign = "&".join(sorted(params)) return compute_hex_hash(to_sign + api_secret, algorithm)