mirror of https://github.com/MedzikUser/imgurs
hotfix: upload image from file (revert encode bytes to base64)
This commit is contained in:
parent
8cd1a31b72
commit
1048ea298f
|
@ -34,9 +34,13 @@ impl ImgurClient {
|
||||||
|
|
||||||
// check if the specified file exists if not then check if it is a url
|
// check if the specified file exists if not then check if it is a url
|
||||||
if Path::new(&path).exists() {
|
if Path::new(&path).exists() {
|
||||||
image = fs::read_to_string(&path)
|
let bytes = fs::read(&path)
|
||||||
.map_err(|err| err.to_string())
|
.map_err(|err| err.to_string())
|
||||||
.expect("read file");
|
.expect("read file");
|
||||||
|
|
||||||
|
image = base64::encode(bytes)
|
||||||
|
|
||||||
|
// validate adress url
|
||||||
} else if !validator::validate_url(&path) {
|
} else if !validator::validate_url(&path) {
|
||||||
let err = io::Error::new(
|
let err = io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
|
|
Loading…
Reference in New Issue