Skip to content

Commit c57008d

Browse files
branchseerclaude
andcommitted
fix: handle Windows path stripping failures gracefully
On Windows, path stripping may fail due to case sensitivity or path format differences between the tracked access path and workspace root. Previously this caused an error like: "Invalid relative path 'D:\a\...\project': path is not relative" This change treats such paths as outside the workspace (returning None) rather than failing, which is consistent with how we handle paths that don't match the workspace prefix. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 14167c2 commit c57008d

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

  • crates/vite_task/src/session/execute

crates/vite_task/src/session/execute/spawn.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,14 @@ where
174174
let path_writes = &mut track_result.path_writes;
175175

176176
for access in termination.path_accesses.iter() {
177-
let relative_path = access
178-
.path
179-
.strip_path_prefix(workspace_root, |strip_result| {
180-
let Ok(stripped_path) = strip_result else {
181-
return None;
182-
};
183-
Some(RelativePathBuf::new(stripped_path).map_err(|err| {
184-
anyhow::anyhow!("Invalid relative path '{}': {}", stripped_path.display(), err)
185-
}))
186-
})
187-
.transpose()?;
177+
let relative_path = access.path.strip_path_prefix(workspace_root, |strip_result| {
178+
let Ok(stripped_path) = strip_result else {
179+
return None;
180+
};
181+
// On Windows, path stripping may fail due to case sensitivity or path format
182+
// differences. Treat these as outside workspace rather than failing.
183+
RelativePathBuf::new(stripped_path).ok()
184+
});
188185

189186
let Some(relative_path) = relative_path else {
190187
// Ignore accesses outside the workspace

0 commit comments

Comments
 (0)