Skip to content

Commit 08fcc61

Browse files
zefir-gitProspectoraecsocket
authored
Make Maven file resolution case-insensitive (#4917)
* Make Maven file resolution case-insensitive * fix string reference * fixed formatting --------- Co-authored-by: Prospector <[email protected]> Co-authored-by: aecsocket <[email protected]>
1 parent b36801c commit 08fcc61

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

apps/labrinth/src/routes/maven.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,10 @@ fn find_file<'a>(
241241
version: &'a VersionQueryResult,
242242
file: &str,
243243
) -> Option<&'a FileQueryResult> {
244-
if let Some(selected_file) =
245-
version.files.iter().find(|x| x.filename == file)
244+
if let Some(selected_file) = version
245+
.files
246+
.iter()
247+
.find(|x| x.filename.eq_ignore_ascii_case(file))
246248
{
247249
return Some(selected_file);
248250
}
@@ -259,7 +261,10 @@ fn find_file<'a>(
259261
}
260262

261263
for fileext in fileexts {
262-
if file == format!("{}-{}.{}", &project_id, &vcoords, fileext) {
264+
if file.eq_ignore_ascii_case(&format!(
265+
"{}-{}.{}",
266+
&project_id, &vcoords, fileext
267+
)) {
263268
return version
264269
.files
265270
.iter()
@@ -313,7 +318,7 @@ pub async fn version_file(
313318
return Err(ApiError::NotFound);
314319
}
315320

316-
if file == format!("{}-{}.pom", &project_id, &vnum) {
321+
if file.eq_ignore_ascii_case(&format!("{}-{}.pom", &project_id, &vnum)) {
317322
let respdata = MavenPom {
318323
schema_location:
319324
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"

0 commit comments

Comments
 (0)