Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
==========================================
+ Coverage 69.31% 70.23% +0.91%
==========================================
Files 7 7
Lines 453 467 +14
Branches 74 78 +4
==========================================
+ Hits 314 328 +14
Misses 136 136
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 6bb6c67. Configure here.
| 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 112 - 127 | ||
| ]); | ||
|
|
||
| const needEscape = /[^A-Za-z0-9!\-.~'()*]/; |
There was a problem hiding this comment.
Regex omits underscore from safe set
Medium Severity
The needEscape regex omits _, which noEscape treats as safe. Long strings containing underscores therefore miss the unchanged-return path and allocate a prefix plus a concatenation even when every character is already safe.
Reviewed by Cursor Bugbot for commit 6bb6c67. Configure here.
anonrig
approved these changes
Oct 12, 2026
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.


Speed up
stringify()for keys and values that contain no characters requiring escaping.encodeStringnow first scans for the first escapable character with a native regex when the string is long enough, and returns it unchanged when it is already safe, instead of running the per-character scanning loop. Short strings keep the original tight loop because regex call overhead dominates there.Measured against the previous implementation, this is neutral on the existing short-string benchmark and ~9% faster on realistic long-value workloads; a 40+ character safe string encodes roughly 2x faster. All tests pass and 20k fuzz cases match
node:querystring.Note
Low Risk
Localized performance change to URL encoding with intended identical output; no security or API surface changes.
Overview
Speeds up query-string encoding when keys or values are long and already “safe” (no characters that need percent-encoding).
encodeStringnow uses a native regex pre-scan for inputs ≥ 16 characters to detect the first character that must be escaped. If none are found, it returns the input unchanged instead of walking every code unit. When escaping is needed, it only runs the existing per-character loop from that point, prefixing the safe leading slice. Shorter strings still use the original tight loop only, because regex overhead would outweigh the benefit.Reviewed by Cursor Bugbot for commit 6bb6c67. Bugbot is set up for automated code reviews on this repo. Configure here.