Conversation
* fix(url): ignore fragment identifiers in getPath() In Service Worker contexts, URLs may contain fragment identifiers (#) which should not be included in route matching. This change modifies getPath() to strip fragment identifiers from the path, consistent with how query strings are already handled. Fixes #4440 * fix: handle fragment before query in percent-encoded paths When a URL contains a fragment with query-like characters (e.g., #section?foo=bar), the previous logic would incorrectly include the fragment in the path because it checked for '?' first and only looked for '#' if '?' was not found. This fix uses Math.min() to find whichever delimiter ('?' or '#') comes first, correctly handling edge cases per RFC 3986 where '#' terminates the path regardless of subsequent '?' characters in the fragment. Added test case for this edge case. * test(url): add test for encoded hash (%23) in path with fragment Verify that percent-encoded hash (%23) is preserved while real fragment identifiers are correctly stripped. decodeURI preserves reserved characters per Web Standards. * perf(url): reduce === -1 evaluations in getPath Restructure ternary to avoid redundant separator === -1 check. For /path?x=1, reduces evaluations from 3 to 2. Co-authored-by: usualoma <usualoma@users.noreply.github.com> * test(url): add coverage for percent encoding without query or fragment Cover the undefined branch when both queryIndex and hashIndex are -1. --------- Co-authored-by: sanosuguru <sa.50.00.no.riku@gmail.com> Co-authored-by: usualoma <usualoma@users.noreply.github.com>
…g to `node.pP` (#4663) * fix: determine if rendered or not by node.vC[0] instead of referring to node.pP * refactor: assign undefined to "pP" instead of deleting it Because that is slightly more likely to be optimized by the JIT * refactor: use while loop instead of for loop for shorter code
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )