From e9a7108f905460d25ae00c1ab31f2f56a78ee268 Mon Sep 17 00:00:00 2001 From: Andre Julius Date: Mon, 3 Apr 2023 14:13:05 +0200 Subject: [PATCH] Fix deprecation warning of base64 crate. See: https://github.com/M3DZIK/imgurs/actions/runs/3871046426/jobs/6598478600 --- src/imgur/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/imgur/mod.rs b/src/imgur/mod.rs index 69f88cb..3e3a7a0 100644 --- a/src/imgur/mod.rs +++ b/src/imgur/mod.rs @@ -59,12 +59,14 @@ impl ImgurClient { /// } /// ``` pub async fn upload_image(&self, path: &str) -> Result { + use base64::prelude::{Engine, BASE64_STANDARD}; + let mut image = path.to_string(); // check if the specified file exists if not then check if it is a url if std::path::Path::new(path).exists() { let bytes = std::fs::read(path)?; - image = base64::encode(bytes) + image = BASE64_STANDARD.encode(bytes) } // validate url adress else if !validator::validate_url(path) {