From d26d9cb2d7f7e9f61c6c1eedaf4e65b397083813 Mon Sep 17 00:00:00 2001 From: Thomas Marchand Date: Wed, 15 May 2024 10:41:26 +0100 Subject: [PATCH] refactor: remove deprecated base64 usage --- src/utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index 3d8a588..57757ba 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -5,7 +5,7 @@ use axum::{ response::{IntoResponse, Response}, Router, }; -use base64::decode; +use base64::{engine::general_purpose::STANDARD, Engine}; use serde::Serialize; use serde_json::Value; use starknet::core::types::FieldElement; @@ -142,7 +142,7 @@ pub fn parse_base64_image(metadata: &str) -> String { .nth(1) .unwrap_or("") .trim_end_matches('}'); - let decoded_bytes = decode(encoded_part).unwrap_or_else(|_| vec![]); + let decoded_bytes = STANDARD.decode(encoded_part).unwrap_or_else(|_| vec![]); let decoded_str = str::from_utf8(&decoded_bytes).unwrap_or("{}"); let v: Value = serde_json::from_str(decoded_str).unwrap_or(serde_json::json!({})); v["image"].as_str().unwrap_or("").to_string()