Skip to content

Commit ad6c749

Browse files
FelixIsaacclaude
andcommitted
fix: convert backslashes in fallback path expansion
- Add backslash-to-forward-slash conversion in fallback function - Handles cases where JSON has raw backslashes from Windows paths - Ensures proper path format on Unix systems 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fea3f5d commit ad6c749

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/sync/paths.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,14 @@ func fallbackExpandPaths(data []byte, claudeDir string) []byte {
9898
content = strings.ReplaceAll(content, ClaudeDirPlaceholder, escapedClaudeDir)
9999
} else {
100100
// Unix: replace placeholder with forward-slash path
101-
// This is safer than replacing all backslashes
102101
normalizedPath := filepath.ToSlash(claudeDir) // ensure forward slashes
103102
content = strings.ReplaceAll(content, ClaudeDirPlaceholder, normalizedPath)
103+
104+
// Also convert Windows-style backslashes to forward slashes
105+
// This handles cases where the stored JSON has raw backslashes from Windows paths
106+
backslash := string(rune(92)) // ASCII 92 = backslash
107+
forwardSlash := `/`
108+
content = strings.ReplaceAll(content, backslash, forwardSlash)
104109
}
105110

106111
return []byte(content)

0 commit comments

Comments
 (0)