Launcher: installing a taken-down registry mod says it was taken down, and why

It said the mod had no version for 26.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-25 15:06:34 +01:00
parent 5680da9834
commit ceff5a2110
2 changed files with 14 additions and 5 deletions
+13 -4
View File
@@ -374,10 +374,19 @@ fn install_from(
/// A project's newest version for this game that wasn't taken down.
fn newest<'a>(index: &Index, p: &'a index::Project) -> Result<&'a index::Version, String> {
p.versions
.iter()
.find(|v| v.game == GAME && index.revoked(&p.id, &v.file.sha256).is_none())
.ok_or_else(|| format!("{} has no version for {GAME} to install.", p.name))
let mut taken_down = None;
for v in p.versions.iter().filter(|v| v.game == GAME) {
match index.revoked(&p.id, &v.file.sha256) {
None => return Ok(v),
Some(r) => {
taken_down.get_or_insert(r);
}
}
}
Err(match taken_down {
Some(r) => format!("{} was taken down: {}", p.name, r.reason),
None => format!("{} has no version for {GAME} to install.", p.name),
})
}
/// Installs version `v` of the registry's mod or resource pack `p` into the game folder `home`.
+1 -1
View File
@@ -123,7 +123,7 @@ fn refuses_a_changed_file_a_taken_id_and_local_files_from_the_real_registry() {
date: String::new(),
});
let e = install_from(&taken_down, true, &p, &home, &|_, _| {}).unwrap_err();
assert!(e.contains("no version"), "{e}");
assert_eq!(e, "Coordinates HUD was taken down: Test.");
fs::remove_dir_all(&home).unwrap();
}