Skip to content

Commit e4f0ddd

Browse files
PR 3655 regression fixes (#3664)
* chore: undo unintended updater `zip` feature drop, tweak comment * fix: correct unintended regression on version and project validation This was caused by a mistake when coalescing mostly copied and pasted `RE_URL_SAFE` regexes into one.
1 parent be425cf commit e4f0ddd

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

Cargo.lock

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ tauri-plugin-os = "2.2.1"
135135
tauri-plugin-single-instance = "2.2.3"
136136
tauri-plugin-updater = { version = "2.7.1", default-features = false, features = [
137137
"rustls-tls",
138+
"zip",
138139
] }
139140
tauri-plugin-window-state = "2.2.2"
140141
tempfile = "3.20.0"

apps/labrinth/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ rust_decimal = { workspace = true, features = [
8888
"serde-with-float",
8989
"serde-with-str",
9090
] }
91-
redis = { workspace = true, features = ["tokio-comp", "ahash", "r2d2"] } # Locked on 0.29 until deadpool-redis updates to 0.30
91+
redis = { workspace = true, features = ["tokio-comp", "ahash", "r2d2"] }
9292
deadpool-redis.workspace = true
9393
clickhouse = { workspace = true, features = ["uuid", "time"] }
9494
uuid = { workspace = true, features = ["v4", "fast-rng", "serde"] }

apps/labrinth/src/routes/v2/users.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ pub async fn projects_list(
135135

136136
#[derive(Serialize, Deserialize, Validate)]
137137
pub struct EditUser {
138-
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_URL_SAFE))]
138+
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_USERNAME))]
139139
pub username: Option<String>,
140140
#[serde(
141141
default,
142142
skip_serializing_if = "Option::is_none",
143143
with = "::serde_with::rust::double_option"
144144
)]
145-
#[validate(length(min = 1, max = 64), regex(path = *crate::util::validate::RE_URL_SAFE))]
145+
#[validate(length(min = 1, max = 64), regex(path = *crate::util::validate::RE_USERNAME))]
146146
pub name: Option<Option<String>>,
147147
#[serde(
148148
default,

apps/labrinth/src/routes/v3/users.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ pub async fn orgs_list(
358358

359359
#[derive(Serialize, Deserialize, Validate)]
360360
pub struct EditUser {
361-
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_URL_SAFE))]
361+
#[validate(length(min = 1, max = 39), regex(path = *crate::util::validate::RE_USERNAME))]
362362
pub username: Option<String>,
363363
#[serde(
364364
default,

apps/labrinth/src/util/validate.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use validator::{ValidationErrors, ValidationErrorsKind};
77
use crate::models::pats::Scopes;
88

99
pub static RE_URL_SAFE: LazyLock<Regex> =
10-
LazyLock::new(|| Regex::new(r"^[a-zA-Z0-9_-]*$").unwrap());
10+
LazyLock::new(|| Regex::new(r#"^[a-zA-Z0-9!@$()`.+,_"-]*$"#).unwrap());
11+
pub static RE_USERNAME: LazyLock<Regex> =
12+
LazyLock::new(|| Regex::new(r#"^[a-zA-Z0-9_-]*$"#).unwrap());
1113

1214
//TODO: In order to ensure readability, only the first error is printed, this may need to be expanded on in the future!
1315
pub fn validation_errors_to_string(

0 commit comments

Comments
 (0)