Repository navigation
fix(platform-redirect): Keep the anchor of the next path - #20227
RaphaelFakhri wants to merge 1 commit into
Conversation
PlatformLink encodes its target, so a link such as /configuration/options/#ignoreErrors reaches /platform-redirect as next=%2Fconfiguration%2Foptions%2F%23ignoreErrors. sanitizeNext only keeps the path, so the redirect and the platform list dropped the anchor and readers landed at the top of the page. Add sanitizeNextHash, which returns the fragment limited to id characters, and append it to the redirect and platform list URLs.
|
@RaphaelFakhri is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
|
The plan checks that platform redirects keep the section marker. It also checks the redirect failure rate and 404s on platform pages. An issue escalates when those redirects fail or platform 404s rise. Services: Mention PlanWhat changedRequests to RiskA bad fragment can make the server redirect throw. Readers then see an error instead of the docs page. A fragment that joins the path can send readers to a missing platform page. The blast reaches every platform redirect. About 900 docs links carry a section marker. Path origin checks are unchanged. A fragment cannot change the redirect origin. Intended effectThe new behavior is a Location header that ends with the section marker.
Regression watchA throw on the new fragment path would raise failures on GET
Not observableSentry does not record the Location fragment. The executor cannot confirm the section marker from spans. Record |
DESCRIBE YOUR PR
PlatformLinkencodes its target when no platform is active, so a link such as<PlatformLink to="/configuration/options/#ignoreErrors">renders as/platform-redirect/?next=%2Fconfiguration%2Foptions%2F%23ignoreErrors.sanitizeNextkeeps only the path, so both the redirect and the links in the platform list drop the anchor, and readers land at the top of a long page such as Options instead of the option the link points to.For example, this request redirects to
/platforms/python//configuration/options/with no#tracing-options:About 900
PlatformLinkuses indocs/and the includes have an anchor, for example on the Issues and errors getting started guide.This change adds
sanitizeNextHash, which returns the fragment ofnextlimited to the characters used in heading and option ids (letters, digits,_,-,.), and appends it to the redirect target and to the platform list links.sanitizeNextand its same-origin checks are unchanged, and a fragment cannot change the origin of the redirect.Tests:
app/platform-redirect/utils.spec.tscovers encoded and plain fragments, dotted option ids, unsafe characters, and malformed encoding.IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace
YYYY-MM-DDwith the due date. You can update this information later by editing the PR description.SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
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.
EXTRA RESOURCES
Fixes #20226