Repository navigation
Conversation
1 task done
|
@goranai is attempting to deploy a commit to the Docsify Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Fixes #2863.
parseQuery()callsdecodeURIComponent()on each query value. A value with a stray%, such as?ref=100%, makes it throwURIError: URI malformed. This runs from the router'sparse(), so the error happens on route change and insidetoURL(). A markdown link like[Sale](guide?ref=100%)then breaks the render of the whole page.This adds a small
safeDecode()helper insrc/core/router/util.js. It returns the decoded value, or the raw text when decoding throws. The search plugin already uses the same pattern (#2767).Behavior changes
?x=100%gives{ x: '100%' }.a%20b%, the whole value is kept raw (a%20b%), not partly decoded.[Sale](guide?ref=100%)now renders as#/guide?ref=100%25, becausestringifyQuery()re-encodes the raw value.Tests
parseQuery()intest/unit/router-util.test.js. The malformed test fails on develop withURIError: URI malformedand passes with the fix.npm run lint: passed.npx tsc --noEmit: passed.npm run test:unit -- --ci --runInBand: 7 suites, 56 tests passed.npm run test:integration -- --ci --runInBand: 9 suites, 79 tests passed.Note
#2811 changes the line just above (
split('=')) inparseQuery()and adds aparseQuery()test block in the same spot. The two changes do not clash in behavior, but one of them will need a small rebase after the other is merged. I'm happy to rebase this one.Validated with Claude Opus 5.5.