From 3d5a7aba91a7767f3656a60d1b08c1ccbe3b90b1 Mon Sep 17 00:00:00 2001 From: damszew Date: Wed, 10 Apr 2024 07:20:28 +0200 Subject: [PATCH] Update deps - incompatible versions --- Cargo.toml | 10 +++++----- src/containers/password.rs | 8 ++++---- src/utils/read_bytes.rs | 16 ++++++++-------- src/utils/sanitized_string.rs | 7 ------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e5e2241..09d6292 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,14 +30,14 @@ metrics = ["dep:metrics", "metrics-exporter-prometheus", "lazy_static", "futures [dependencies] actix = "0.13" -actix-cors = "0.6" +actix-cors = "0.7" actix-http = "3" actix-service = "2" actix-web = "4" actix-multipart = { version = "0.6", features = ["derive"], optional = true } amiquip = { version = "0.4", optional = true } awc = { version = "3", features = ["rustls"], optional = true } -alcoholic_jwt = { version = "1.0", optional = true } +alcoholic_jwt = { version = "4091.0", optional = true } bytes = "1" chrono = { version = "0.4", features = ["serde"] } crossbeam-channel = { version = "0.5", optional = true } @@ -57,8 +57,8 @@ rand = { version = "0.8", optional = true } rust-argon2 = { version = "2", optional = true } serde = { version = "1", features = ["derive"] } serde_json = { version = "1" } -validator = "0.16" -validator_derive = "0.16" +validator = "0.18" +validator_derive = "0.18" weighted-rs = { version = "0.1", optional = true } colored = "2.1" @@ -68,6 +68,6 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter", "tracing-lo tracing-bunyan-formatter = { version = "0.3", optional = true } metrics = { version = "0.22.3", optional = true } -metrics-exporter-prometheus = { version = "0.13.1", optional = true } +metrics-exporter-prometheus = { version = "0.14.0", optional = true } lazy_static = { version = "1.4.0", optional = true } futures-util = { version = "0.3.30", optional = true } diff --git a/src/containers/password.rs b/src/containers/password.rs index 6e9893b..8537319 100644 --- a/src/containers/password.rs +++ b/src/containers/password.rs @@ -1,6 +1,6 @@ -use std::fmt::Formatter; use derive_more::Display; -use serde::{Deserialize, Serializer, Serialize}; +use serde::{Deserialize, Serialize, Serializer}; +use std::fmt::Formatter; use std::ops::Deref; /// String wrapper that serializes to 6 asterisks @@ -12,7 +12,7 @@ pub struct Password(pub String); impl Serialize for Password { fn serialize(&self, serializer: S) -> Result where - S: Serializer + S: Serializer, { serializer.serialize_str("******") } @@ -36,4 +36,4 @@ impl std::fmt::Debug for Password { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_str("********") } -} \ No newline at end of file +} diff --git a/src/utils/read_bytes.rs b/src/utils/read_bytes.rs index a8a6bb0..7287113 100644 --- a/src/utils/read_bytes.rs +++ b/src/utils/read_bytes.rs @@ -2,15 +2,14 @@ use actix_multipart::{Multipart, MultipartError}; use actix_web::error::PayloadError; use bytes::{Bytes, BytesMut}; use futures::TryStreamExt; -use validator::HasLen; +use validator::ValidateLength; /// Helper for reading multipart/form-data, returning vector of read bytes. pub async fn read_bytes( mut payload: Multipart, max_parts: u64, - max_upload_size: usize + max_upload_size: usize, ) -> Result)>, MultipartError> { - let mut files = Vec::new(); // Used to set default position if there is no name or value is not integer let mut incr_default_position = 0; @@ -29,7 +28,7 @@ pub async fn read_bytes( } if !file.is_empty() { - let position:i32 = field + let position: i32 = field .content_disposition() .get_name() .and_then(|r| r.parse::().ok()) @@ -38,16 +37,17 @@ pub async fn read_bytes( files.push(( file.freeze(), position, - field.headers() + field + .headers() .get("Content-Disposition") - .and_then(|v| v.to_str().ok().map(String::from)) + .and_then(|v| v.to_str().ok().map(String::from)), )); } incr_default_position += 1; // Increment default position - if files.length() >= max_parts { - break + if files.length() >= Some(max_parts) { + break; } } diff --git a/src/utils/sanitized_string.rs b/src/utils/sanitized_string.rs index 56a5d5e..3fa2a10 100644 --- a/src/utils/sanitized_string.rs +++ b/src/utils/sanitized_string.rs @@ -1,7 +1,6 @@ use std::borrow::Cow; use serde::{Deserialize, Deserializer, Serialize}; -use validator::HasLen; /// Wrapper for String that gets automatically trimmed during deserialization #[cfg_attr(feature = "swagger", derive(paperclip::actix::Apiv2Schema))] @@ -43,12 +42,6 @@ impl From for SanitizedString { } } -impl HasLen for &SanitizedString { - fn length(&self) -> u64 { - self.0.length() - } -} - #[cfg(test)] mod tests { use validator::Validate;