fix(releases): strip trailing slash from ?project= so the page loads - #124243
Open
parh0m2007 wants to merge 1 commit into
Open
fix(releases): strip trailing slash from ?project= so the page loads#124243parh0m2007 wants to merge 1 commit into
parh0m2007 wants to merge 1 commit into
Conversation
A trailing slash on the ?project= parameter (e.g. ?project=12345/) fails backend validation: '12345/' is neither a decimal id nor a valid slug, so ProjectIdOrSlugField rejects it with a 400. Because ReleasesDetail filters 400 errors out of visibleErrors, the page silently renders blank instead of showing an error. Normalize the project param on mount by stripping trailing slashes and replacing the URL, so all requests pick up the cleaned value. Fixes getsentry#117298
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.
Problem
When a release detail URL has a trailing slash on the
?project=parameter value (e.g..../explore/releases/testrelease@1.0/?project=12345/), the page enters a loading state and then renders blank — no error message, no invalid project warning.Closes #117298
Root cause
Two behaviors stack:
ProjectIdOrSlugFieldvalidation rejects"12345/"— it is neither a decimal id (isdecimal()fails because of the slash) nor a valid slug (MIXED_SLUG_PATTERNdoes not allow/) — so the release endpoint responds 400 "Invalid project".ReleasesDetaildeliberately filters 400s out ofvisibleErrors("Only show non-400 errors"), so the error is swallowed.releasestaysundefined,projectcan't be resolved, and the component returnsnull— a silent blank page.Solution
Normalize the
projectquery param on mount inReleasesDetailContainer: if it carries trailing slashes, strip them and replace the URL (samenavigate(..., {replace: true})pattern already used there to drop global datetime params from the URL). All requests then pick up the cleaned value and the page loads normally.Recipes
master:?project=12345/→ blank page, no error?project=12345and the release detail page loadsindex.spec.tsxcovering both casesEvidence
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.