Repository navigation
fix(docs-mcp): strip query strings and fragments from docs URLs - #1767
Open
pcbeingused333 wants to merge 4 commits into
Open
pcbeingused333 wants to merge 4 commits into
pcbeingused333 wants to merge 4 commits into
Conversation
normalizeDocPath kept '?' and '#', so fetchDocPage appended '.md' to the whole string and requested e.g. '#tracing.md' instead of '<pathname>.md'; the HTML response was then cached as Markdown. Drop the query and fragment before the other normalisation steps. Fixes getsentry#1618 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…y and fragment Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…does Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
Fixes #1618
Cause.
normalizeDocPathinapps/docs-mcp/src/sentry-docs/fetcher.tskeeps?queryand#fragment, andfetchDocPagethen appends.mdto the whole string.https://docs.sentry.io/platforms/javascript/#tracingbecomes a request for/platforms/javascript/with fragment#tracing.md, so the server returns the HTML page, which is cached as Markdown for an hour.Fix. Strip the query string and fragment first, before the origin,
.md, trailing-slash and leading-slash steps. The exact-origin boundary is unchanged (https://docs.sentry.io.example.com/...?x=1is still treated as a path, not as docs.sentry.io). Every caller ofnormalizeDocPath(fetchDocPage, the agent tools, the doctree and the citation URLs) gets the cleaned pathname.Tests.
apps/docs-mcp/src/__tests__/fetcher.test.tsgains cases for full URLs and relative paths with a query, a fragment or both, for the bare origin with?/#, for the origin boundary with a query string, and afetchDocPagetest that checks the outbound request URL ishttps://docs.sentry.io/platforms/javascript.md.This change was prepared with the assistance of an AI tool (Claude) and submitted by the account owner.