Repository navigation
fix(server): read a file:// folder link on Windows - #817
Merged
Ishaan Gangwani (ishaan1124) merged 3 commits intoSep 29, 2026
Merged
Ishaan Gangwani (ishaan1124) merged 3 commits into
Ishaan Gangwani (ishaan1124) merged 3 commits into
Conversation
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 28, 2026 21:45
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/folder-resolve-windows-path
branch
from
September 29, 2026 04:55
63806e3 to
91de12f
Compare
URL.pathname keeps the leading slash on a drive URL, so a link to C:/Users/me became C:\C:\Users\me and the folder could not be selected. decodeURIComponent also threw URIError on a stray percent, which surfaced as a failed request instead of a path that does not exist. Decode each escape on its own and drop the URL drive slash.
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/folder-resolve-windows-path
branch
from
September 29, 2026 10:49
91de12f to
a982108
Compare
Decoding each %XX escape on its own never decoded a multi-byte UTF-8 character, and URL percent-encodes non-ASCII even in raw input, so a folder named café or 数据 no longer resolved on macOS or Linux. Stripping the drive slash on every platform also made file:///C:/x cwd-relative on POSIX. fileURLToPath decodes UTF-8 and gives C:\x and \\server\share on Windows; a stray % is escaped before it (it throws there), and a remote host off Windows, an encoded slash or a non-UTF-8 escape fall back to the leniently decoded pathname. Co-authored-by: Cursor <cursoragent@cursor.com>
Member
|
I pushed one commit (63bf11d) on top of yours. Decoding each |
# Conflicts: # CHANGELOG.md
Ishaan Gangwani (ishaan1124)
merged commit Sep 29, 2026
fac19d0
into
synthetic-sciences:main
8 of 9 checks passed
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.
What
The folder-validate route expands the client's path like this:
URL.pathnamekeeps the leading slash on a drive URL, anddecodeURIComponentthrows on a malformed escape.Why it matters
Measured on this Windows machine with the original expression:
path.resolve("/C:/Users/me/Desktop")prepends the current drive to a string that already has one, and the route then answerspath not foundfor a folder that is really there.A plain path works and a
file://link does not, which is the confusing part: the same folder is selectable one way and not the other. This is the route behind "choose a folder", so it is exactly the path a user takes when the browser hands over afile://link.The POSIX line is the same bug mirrored: on a POSIX host
file:///home/me/datais already correct, so this only ever surfaced on Windows.And a stray
%doesn't produce a "no such folder" answer — nothing catchesURIError, so the request fails outright.Verification
expandPathwas module-private with no test, so this exports it and addstest/server/folder-resolve-path.test.ts. Four of five cases fail before the fix:The POSIX case is asserted against
path.resolverather than a literal, so it stays correct on POSIX hosts too. The stray-percent case assertsnot.toThrowinstead of an exact string, since the point is that a bad escape degrades to a path that does not exist rather than a failed request.The neighbouring
test/server/project-folders.test.tsis 4 pass / 3 fail both before and after — identical tomainin this checkout. (At the default 15 s timeout those tests take 20-40 s and the result flaps; at a realistic timeout it is stable and identical to baseline. The 3 baseline failures are Windows symlink/EPERMcases.)The change
Bun 1.3.14 has no
URL.filePath— verified, it isundefined— so the drive slash is stripped explicitly rather than relying on a platform accessor.On the generated SDK
AGENTS.mdasks for./tooling/repo/generate.tsafter asrc/serverchange, so it was run. It rewrote 31 files, butgit diff --statreports 0 lines foropenapi.jsonand the diff is otherwise empty — line endings only. No route, parameter, or response field changed, so the generated client is unchanged and that churn was reverted.bun run typecheckclean; touched files are Prettier-clean (checked on LF-normalized copies — this checkout hascore.autocrlf=true, which makes Prettier flag every file in the repo).Fixes #816