Skip to content

Commit

Permalink
hotfix: upload image from file (revert encode bytes to base64)
Browse files Browse the repository at this point in the history
  • Loading branch information
M3DZIK committed Apr 5, 2022
1 parent 8cd1a31 commit 1048ea2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1048ea2

Please sign in to comment.