mirror of
https://github.com/MedzikUser/imgurs
synced 2024-08-15 00:03:19 +00:00
Fix deprecation warning of base64 crate.
See: https://github.com/M3DZIK/imgurs/actions/runs/3871046426/jobs/6598478600
This commit is contained in:
parent
0398f7f675
commit
e9a7108f90
1 changed files with 3 additions and 1 deletions
|
@ -59,12 +59,14 @@ impl ImgurClient {
|
|||
/// }
|
||||
/// ```
|
||||
pub async fn upload_image(&self, path: &str) -> Result<ImageInfo> {
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue