Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4520770. Configure here.
| StringPrototypeIndexOf(filepath, '.') === -1 && | ||
| StringPrototypeIndexOf(filepath, '//') === -1) { | ||
| // Already an absolute POSIX path with no '.' / '..' or empty segments. | ||
| resolved = filepath; |
There was a problem hiding this comment.
Trailing slashes doubled on Windows
Medium Severity
Skipping path.resolve keeps a trailing slash on already-absolute POSIX paths. The later restore still appends another slash when resolved does not end with path.sep. On Windows, path.sep is a backslash, so pathToFileURL with windows: false emits a double slash and a wrong file: URL for directory paths.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 4520770. Configure here.
pathToFileURL always called path.resolve, even when the input was already an absolute POSIX path with no '.' / '..' or empty segments. Reuse that path and drop a trailing slash the same way posix.resolve does, so the later restore does not append a second slash when path.sep is '\' (Windows host, windows: false). Official benchmark/url/whatwg-url-to-and-from-path.js pathToFileURL is about 27% faster for /dev/null and about 45-48% faster when the path has a query or hash. fileURLToPath is unchanged. Assisted-by: a closed-source coding agent Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com> Co-authored-by: Yagiz Nizipli <anonrig@users.noreply.github.com>
cursor
Bot
force-pushed
the
cursor/url-path-fast-ead2
branch
from
September 22, 2026 06:32
c663b90 to
ca37e8f
Compare
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.


pathToFileURLalways calledpath.resolve, even when the input was already an absolute POSIX path with no./..or empty//segments. Reuse that path. Windows UNC and relative paths still go throughpath.resolve.Official
benchmark/url/whatwg-url-to-and-from-path.js(--no-node-snapshot, 4 alternating runs vs parent):pathToFileURL/dev/nullpathToFileURL/dev/null?key=param&boolpathToFileURL/dev/null?key=param&bool#hashpathToFileURLfile:///dev/null(relative path string)fileURLToPathfile:///dev/nulltest/parallel/test-url-pathtofileurl.jsandtest-url-fileurltopath.jspass. A closed-source coding agent assisted with the implementation.