Skip to content

Commit

Permalink
Update deps - incompatible versions
Browse files Browse the repository at this point in the history
  • Loading branch information
damszew authored and sfisol committed Apr 20, 2024
1 parent 0c08b0f commit 8a879c0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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"

Expand All @@ -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 }
8 changes: 4 additions & 4 deletions src/containers/password.rs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,7 +12,7 @@ pub struct Password(pub String);
impl Serialize for Password {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer
S: Serializer,
{
serializer.serialize_str("******")
}
Expand All @@ -36,4 +36,4 @@ impl std::fmt::Debug for Password {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.write_str("********")
}
}
}
16 changes: 8 additions & 8 deletions src/utils/read_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<(Bytes, i32, Option<String>)>, 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;
Expand All @@ -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::<i32>().ok())
Expand All @@ -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;
}
}

Expand Down
7 changes: 0 additions & 7 deletions src/utils/sanitized_string.rs
Original file line number Diff line number Diff line change
@@ -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))]
Expand Down Expand Up @@ -43,12 +42,6 @@ impl From<String> for SanitizedString {
}
}

impl HasLen for &SanitizedString {
fn length(&self) -> u64 {
self.0.length()
}
}

#[cfg(test)]
mod tests {
use validator::Validate;
Expand Down

0 comments on commit 8a879c0

Please sign in to comment.