-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Problem
There are two path encoding functions with different behavior:
internal/config/config.go:172-186-encodeProjectPathinternal/history/paths.go:22-34-EncodeProjectPath
Evidence
config.go version:
func encodeProjectPath(path string) string {
result := ""
for _, c := range path {
if c == filepath.Separator {
result += "-"
} else if c == ':' {
continue // Skip Windows colon
} else {
result += string(c) // KEEPS DOTS
}
}
return result
}paths.go version:
func EncodeProjectPath(path string) string {
encoded := strings.ReplaceAll(path, string(filepath.Separator), "-")
encoded = strings.ReplaceAll(encoded, ".", "-") // REPLACES DOTS
// ...
}The key difference: history.EncodeProjectPath replaces dots with dashes, while config.encodeProjectPath preserves dots.
Impact
This inconsistency could cause path mismatches if both functions are used in different parts of the codebase with the expectation of matching results.
Suggested Fix
- Delete the private
config.encodeProjectPathfunction - Use the public
history.EncodeProjectPatheverywhere - The
historypackage version should be canonical since it's the public API
Files:
internal/config/config.go:172-186internal/history/paths.go:22-34
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels