From bc240951d6cf9f8289bb69522fcdc9990fdf4d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Wed, 26 Apr 2023 15:56:03 +0200 Subject: [PATCH] crypto: Enable decoding padded base64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- crates/matrix-sdk-crypto/src/utilities.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/utilities.rs b/crates/matrix-sdk-crypto/src/utilities.rs index 09c7626dd..b87884425 100644 --- a/crates/matrix-sdk-crypto/src/utilities.rs +++ b/crates/matrix-sdk-crypto/src/utilities.rs @@ -28,8 +28,11 @@ use base64::{ }; use matrix_sdk_common::instant::Instant; -const STANDARD_NO_PAD: GeneralPurpose = - GeneralPurpose::new(&alphabet::STANDARD, general_purpose::NO_PAD); +const STANDARD_NO_PAD: GeneralPurpose = GeneralPurpose::new( + &alphabet::STANDARD, + general_purpose::NO_PAD + .with_decode_padding_mode(base64::engine::DecodePaddingMode::Indifferent), +); /// Decode the input as base64 with no padding. pub fn decode(input: impl AsRef<[u8]>) -> Result, DecodeError> {