From 3fcafd61196c8253b9f6b7691911558b4df3f9db Mon Sep 17 00:00:00 2001 From: MrRaph_ Date: Thu, 22 May 2025 16:43:11 +0000 Subject: [PATCH] fix: hashmac --- wp-thumbor.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-thumbor.php b/wp-thumbor.php index 4805105..e0a02ac 100644 --- a/wp-thumbor.php +++ b/wp-thumbor.php @@ -240,7 +240,8 @@ function wp_thumbor_transform_url($url, $width = null, $height = null) { // Détermine l'endpoint : si une clé secrète est renseignée, on signe, sinon on utilise "unsafe" if ( ! empty($options['thumbor_secret_key']) ) { $hmac = hash_hmac('sha1', $path_to_sign, $options['thumbor_secret_key'], true); - $encoded_signature = strtr(base64_encode($hmac), '+/', '-_'); + // on enlève aussi les '=' de padding pour que Thumbor accepte la signature + $encoded_signature = rtrim(strtr(base64_encode($hmac), '+/', '-_'), '='); $endpoint = $encoded_signature; } else { $endpoint = 'unsafe';