IVS-866 - Ability to navigate to end-user reports - #315
Merged
Conversation
Ghesselink
requested changes
Aug 4, 2026
Comment on lines
+434
to
+446
| if id.startswith("r"): | ||
| priv_id = ValidationRequest.to_private_id(id) | ||
|
|
||
| elif id.startswith("m"): | ||
| model_id = Model.to_private_id(id) | ||
| priv_id = ( | ||
| ValidationRequest.objects.filter(model_id=model_id) | ||
| .values_list("id", flat=True) | ||
| .first() | ||
| ) | ||
|
|
||
| if not priv_id: | ||
| return HttpResponseNotFound() |
Contributor
There was a problem hiding this comment.
The code only creates priv_id when the id starts with r or m, so any other id (like t42 or whatever) reaches 'if not priv_id). This doesn't exist or can't convert to an integer and crashes with a 500 error. Adding else: return HttpResponseNotFound() and try/except makes those ids get 404 instead.
Suggested change
| if id.startswith("r"): | |
| priv_id = ValidationRequest.to_private_id(id) | |
| elif id.startswith("m"): | |
| model_id = Model.to_private_id(id) | |
| priv_id = ( | |
| ValidationRequest.objects.filter(model_id=model_id) | |
| .values_list("id", flat=True) | |
| .first() | |
| ) | |
| if not priv_id: | |
| return HttpResponseNotFound() | |
| try: | |
| if id.startswith("r"): | |
| priv_id = ValidationRequest.to_private_id(id) | |
| elif id.startswith("m"): | |
| model_id = Model.to_private_id(id) | |
| priv_id = ( | |
| ValidationRequest.objects.filter(model_id=model_id) | |
| .values_list("id", flat=True) | |
| .first() | |
| ) | |
| else: | |
| return HttpResponseNotFound() | |
| except ValueError: | |
| return HttpResponseNotFound() | |
| if not priv_id: | |
| return HttpResponseNotFound() |
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.
request_id(as-is) andmodel_idis_staffusers to render all reports