Repository navigation
fix(runners): don't crash the runtime API on "Lutris/x.y.z" user agents - #771
Merged
Merged
Conversation
RuntimeVersions and RuntimeListView took the client version from user_agent.split()[1], which raised IndexError (a 500 on /api/runtimes/versions) for any user agent starting with "Lutris" but without a space, such as "Lutris/0.5.22". Parse the version in one helper that accepts both separators and answers ClientTooOld when no version can be read. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Production error reports on 2026-09-27 and 2026-09-30:
IndexError: list index out of rangeatrunners/views.pyinRuntimeVersions.get, onGET /api/runtimes/versions.Both requests used the user agent
Lutris/0.5.22. The client itself sendsLutris 0.5.22, but anything starting withLutriswithout a space crashed onuser_agent.split()[1].RuntimeListView.get_querysethad the same line.This PR adds a single helper,
get_client_version_number(user_agent), which both views now use:Lutris 0.5.22andLutris/0.5.22ClientTooOld(426) instead of a 500 when no valid version can be read, e.g. a bareLutrisThe
< 0.5.11minimum check inRuntimeListViewbehaves the same.Tests: new
TestClientVersioncases cover both separators, non-Lutris agents, a bareLutris, and an end-to-end call to/api/runtimes/versionswithLutris/0.5.22. The end-to-end call raisesIndexErrorwithout the fix. The full suite passes (171 tests), as doruff checkandruff format --check.🤖 Generated with Claude Code