this should solve the in rust nightly

This commit is contained in:
MedzikUser 2022-01-22 23:19:59 +01:00
parent 22e28497a7
commit 8fff3a2b4c
No known key found for this signature in database
GPG Key ID: A5FAC1E185C112DB
1 changed files with 1 additions and 3 deletions

View File

@ -10,14 +10,12 @@ use chrono::Utc;
use std::time::{Duration, UNIX_EPOCH};
pub async fn upload_image(client: ImgurHandle, path: &str) {
let image: String;
let mut image: String = path.to_string();
if Path::new(path).exists() {
let bytes = fs::read(path).map_err(|err| err.to_string()).unwrap();
image = base64::encode(bytes);
} else {
image = path.to_string()
}
match imgurs::api::upload_image::upload_image(client, &image).await {