From 08fcc61d35cc5ff7b7bd83ef23d3137b596334a9 Mon Sep 17 00:00:00 2001 From: Zefir Date: Wed, 21 Jan 2026 03:15:33 +0200 Subject: [PATCH] Make Maven file resolution case-insensitive (#4917) * Make Maven file resolution case-insensitive * fix string reference * fixed formatting --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com> Co-authored-by: aecsocket --- apps/labrinth/src/routes/maven.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/labrinth/src/routes/maven.rs b/apps/labrinth/src/routes/maven.rs index 878f6dabc..510411523 100644 --- a/apps/labrinth/src/routes/maven.rs +++ b/apps/labrinth/src/routes/maven.rs @@ -241,8 +241,10 @@ fn find_file<'a>( version: &'a VersionQueryResult, file: &str, ) -> Option<&'a FileQueryResult> { - if let Some(selected_file) = - version.files.iter().find(|x| x.filename == file) + if let Some(selected_file) = version + .files + .iter() + .find(|x| x.filename.eq_ignore_ascii_case(file)) { return Some(selected_file); } @@ -259,7 +261,10 @@ fn find_file<'a>( } for fileext in fileexts { - if file == format!("{}-{}.{}", &project_id, &vcoords, fileext) { + if file.eq_ignore_ascii_case(&format!( + "{}-{}.{}", + &project_id, &vcoords, fileext + )) { return version .files .iter() @@ -313,7 +318,7 @@ pub async fn version_file( return Err(ApiError::NotFound); } - if file == format!("{}-{}.pom", &project_id, &vnum) { + if file.eq_ignore_ascii_case(&format!("{}-{}.pom", &project_id, &vnum)) { let respdata = MavenPom { schema_location: "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"