Repository navigation
fix(scenarios): Handle non-numeric 'set' query parameter gracefully - #16
Merged
Merged
Conversation
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.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.
The
/scenarios/page previously crashed with aValueError(resulting in a 500 error) if thesetquery parameter in the URL was not a valid integer (e.g.,?set=4%5C). This occurred because the value was passed directly toScenarioSet.objects.filter(pk=...)without prior validation.This change introduces a check to ensure that the
setparameter is numeric (isdigit()) before attempting to use it for a primary key lookup. If the parameter is not a valid number, theselectedscenario set will remainNone, causing the page to render the list of all scenario sets instead of crashing. This approach mirrors the existing validation logic for theversionquery parameter.Fixes SIMPLEAUDITSTUDIO-2H
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this run