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) {