From 1048ea298fd624f36e2bea8393af6f9359901912 Mon Sep 17 00:00:00 2001 From: MedzikUser Date: Tue, 5 Apr 2022 17:03:57 +0200 Subject: [PATCH] hotfix: upload image from file (revert encode bytes to base64) --- src/api/client.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/client.rs b/src/api/client.rs index 23534ac..cb7b54b 100644 --- a/src/api/client.rs +++ b/src/api/client.rs @@ -34,9 +34,13 @@ impl ImgurClient { // check if the specified file exists if not then check if it is a url if Path::new(&path).exists() { - image = fs::read_to_string(&path) + let bytes = fs::read(&path) .map_err(|err| err.to_string()) .expect("read file"); + + image = base64::encode(bytes) + + // validate adress url } else if !validator::validate_url(&path) { let err = io::Error::new( io::ErrorKind::Other,