Update dependencies and replace validator crate with url crate

This commit is contained in:
Andre Julius 2024-04-11 21:07:32 +02:00 committed by Oskar Karpiński
parent e782617f08
commit af0864d272
4 changed files with 1093 additions and 883 deletions

1947
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -27,10 +27,10 @@ codegen-units = 1
[dependencies]
# HTTP
reqwest = { version = "0.11", default-features = false, features = ["json", "multipart"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart"] }
# Request
base64 = "0.21"
validator = "0.16" # validate url address
base64 = "0.22"
url = "2.5.0" # validate url address
# Response
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
@ -40,4 +40,4 @@ thiserror = "1.0"
[dev-dependencies]
# Async tests
tokio = { version = "1.25", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] }

View File

@ -16,11 +16,11 @@ path = "src/main.rs"
[dependencies]
# Async runtime
tokio = { version = "1.25", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] }
# CLI
clap = { version = "4.1", features = ["derive"] }
clap_complete = "4.1"
clap = { version = "4.5", features = ["derive"] }
clap_complete = "4.5"
clap_mangen = "0.2"
# Errors
@ -28,19 +28,19 @@ anyhow = "1.0"
# Logger
log = { version = "0.4", features = ["release_max_level_info"] }
simple_logger = "4.0"
colored = "2.0"
simple_logger = "4.3"
colored = "2.1"
# Config
toml = "0.7"
toml = "0.8"
serde = { version = "1.0", features = ["derive"] }
# Other
chrono = "0.4" # parse upload date
notify-rust = "4.7" # send notification after upload
dirs = "4.0" # get system configuration directory
notify-rust = "4.11" # send notification after upload
dirs = "5.0" # get system configuration directory
imgurs = { path = "..", version = "0.11.0", features = ["full"] }
[target.'cfg(not(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten")))))'.dependencies]
arboard = "3.2" # copy url to clipboard
arboard = "3.3" # copy url to clipboard

View File

@ -9,6 +9,7 @@ pub(crate) use client::api_url;
pub use client::ImgurClient;
pub use image_type::*;
pub use send_api_request::*;
use url::Url;
use crate::{Error, Result};
@ -69,7 +70,7 @@ impl ImgurClient {
image = BASE64_STANDARD.encode(bytes)
}
// validate url adress
else if !validator::validate_url(path) {
else if Url::parse(&path).is_err() {
Err(Error::InvalidUrlOrFile(path.to_string()))?;
}