mirror of
https://github.com/MedzikUser/imgurs
synced 2024-08-15 00:03:19 +00:00
hotfix: upload image from file (revert encode bytes to base64)
This commit is contained in:
parent
8cd1a31b72
commit
1048ea298f
1 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue