fix(workspace): use path.isAbsolute() for Windows path compatibility#413
Open
Lygggggg wants to merge 2 commits intozts212653:mainfrom
Open
fix(workspace): use path.isAbsolute() for Windows path compatibility#413Lygggggg wants to merge 2 commits intozts212653:mainfrom
Lygggggg wants to merge 2 commits intozts212653:mainfrom
Conversation
The worktrees endpoint rejected Windows absolute paths (e.g. C:\...)
because it checked repoRoot.startsWith('/') which only matches Unix
paths. Replace with Node.js path.isAbsolute() which handles both
Windows and Unix paths correctly. isAbsolute was already imported
but unused for this check.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that isAbsolute() correctly accepts Windows absolute paths
(C:\..., C:/..., UNC \server\share) and rejects relative paths.
Prevents regression of the startsWith('/') bug.
Closes zts212653#414
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Closes #414
Summary
repoRoot.startsWith('/')rejects Windows absolute paths likeC:\...path.isAbsolute()(already imported) which handles both Windows and Unix pathsRoot Cause
GET /api/workspace/worktrees?repoRoot=C:\...returns 400 because the path validation assumes Unix-style absolute paths. Frontendcatch { /* ignore */ }silently swallows the error, resulting in an empty workspace panel (no files, no changes, no git info).Changes
packages/api/src/routes/workspace.ts:283—startsWith('/')→isAbsolute()packages/api/test/workspace-windows-path.test.js— regression test (7 cases)Test Evidence
Test plan
🤖 Generated with Claude Code