mirror of https://github.com/MedzikUser/imgurs
this should solve the in rust nightly
This commit is contained in:
parent
22e28497a7
commit
8fff3a2b4c
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue