mirror of https://github.com/MedzikUser/imgurs
cli: add url validate
This commit is contained in:
parent
7455932107
commit
6d01fe6112
|
@ -8,11 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
<!-- next-header -->
|
<!-- next-header -->
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
- SimpleLogger init error handling
|
|
||||||
|
|
||||||
### CLI
|
### CLI
|
||||||
|
- SimpleLogger init error handling
|
||||||
- better panic
|
- better panic
|
||||||
- panic instead of send log error
|
- panic instead of send log error
|
||||||
|
- add url validate
|
||||||
|
|
||||||
### Library
|
### Library
|
||||||
- The returned error in the Result is from now on anyhow::Error and not String.
|
- The returned error in the Result is from now on anyhow::Error and not String.
|
||||||
|
@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
- move api request to fn send_api_request
|
- move api request to fn send_api_request
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* api rate limit (error decoding response body: invalid value: integer \`200\`, expected i8 at line 1 column 140)
|
- api rate limit (error decoding response body: invalid value: integer \`200\`, expected i8 at line 1 column 140)
|
||||||
|
|
||||||
## [0.1.0] - 2022-01-23
|
## [0.1.0] - 2022-01-23
|
||||||
### CLI
|
### CLI
|
||||||
|
|
|
@ -30,6 +30,7 @@ notify-rust = "4.5.5"
|
||||||
clap_complete = "3.0.5"
|
clap_complete = "3.0.5"
|
||||||
anyhow = "1.0.53"
|
anyhow = "1.0.53"
|
||||||
better-panic = "0.3.0"
|
better-panic = "0.3.0"
|
||||||
|
validator = "0.14.0"
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "3.0.13"
|
version = "3.0.13"
|
||||||
|
|
|
@ -13,6 +13,8 @@ pub async fn upload_image(client: ImgurClient, path: &str) {
|
||||||
.map_err(|err| err.to_string())
|
.map_err(|err| err.to_string())
|
||||||
.expect("read file");
|
.expect("read file");
|
||||||
image = base64_encode(bytes);
|
image = base64_encode(bytes);
|
||||||
|
} else if !validator::validate_url(path) {
|
||||||
|
panic!("{path} is not a url")
|
||||||
}
|
}
|
||||||
|
|
||||||
let i = upload_img(client, &image).await.expect("send api request");
|
let i = upload_img(client, &image).await.expect("send api request");
|
||||||
|
|
Loading…
Reference in New Issue