Skip to content

fix(upgrade): skip Modrinth versions with empty files#516

Open
SAY-5 wants to merge 1 commit into
gorilla-devs:mainfrom
SAY-5:fix/skip-empty-modrinth-version-files
Open

fix(upgrade): skip Modrinth versions with empty files#516
SAY-5 wants to merge 1 commit into
gorilla-devs:mainfrom
SAY-5:fix/skip-empty-modrinth-version-files

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 21, 2026

Fixes #514.

Problem

When ferium upgrade fetches the Modrinth version list for a project, some legacy/broken entries can come back with an empty files array (e.g. EasyAuth, Silk in the issue thread). from_mr_version then calls VersionExt::get_version_file, which does .unwrap_or(&self.files[0]) and panics:

thread 'ferium-worker' panicked at libium/src/version_ext.rs:15:35:
index out of bounds: the len is 0 but the index is 0

Fix

Filter empty-files versions out of version_list() results in mod_downloadable.rs before mapping with from_mr_version. They are skipped the same way they would be if no version satisfied the filters, instead of crashing the worker.

Mirrors the no-files-available handling added for Modrinth modpacks in #508.

Testing

cargo build -p libium --lib and cargo clippy -p libium --lib --no-deps -- -D warnings pass cleanly. cargo test -p libium --lib runs (no existing unit tests in libium).

A Modrinth project version can have an empty files array (some
legacy/broken entries on the API). from_mr_version then calls
VersionExt::get_version_file which indexes self.files[0] and panics
with 'index out of bounds: the len is 0 but the index is 0'.

Filter empty-files versions out of the version list before mapping,
so they are silently skipped instead of crashing ferium-worker.

Fixes gorilla-devs#514
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashes when a version has no version files

2 participants