fix: hashmac

This commit is contained in:
MrRaph_
2025-05-22 16:43:11 +00:00
parent a51bd0b8c9
commit 3fcafd6119

View File

@@ -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';