mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
fix(labrinth): return last file if no primary is found (#6946)
* fix(labrinth): return last file if no primary is found * style(labrinth): clippy
This commit is contained in:
@@ -277,8 +277,11 @@ fn find_file<'a>(
|
||||
|
||||
if file_name.eq_ignore_ascii_case(&formatted_name) {
|
||||
return filtered_files
|
||||
.find(|x| x.primary)
|
||||
.or_else(|| filtered_files.next_back());
|
||||
.try_fold(
|
||||
None,
|
||||
|_, x| if x.primary { Err(x) } else { Ok(Some(x)) },
|
||||
)
|
||||
.unwrap_or_else(Some);
|
||||
} else if file_name.len() > formatted_name.len()
|
||||
&& file_name.as_bytes()[..formatted_name.len()]
|
||||
.eq_ignore_ascii_case(formatted_name.as_bytes())
|
||||
|
||||
Reference in New Issue
Block a user