Clean file path names on file creation (#624)

This commit is contained in:
Thomas Miceli
2026-02-25 22:30:26 +07:00
committed by GitHub
parent 7b1048ec30
commit b097cfcbc0
3 changed files with 47 additions and 25 deletions

19
internal/git/file.go Normal file
View File

@@ -0,0 +1,19 @@
package git
import (
"path/filepath"
"strings"
)
func CleanTreePathName(s string) string {
name := filepath.Base(s)
if name == "." || name == ".." {
return ""
}
name = strings.ReplaceAll(name, "/", "")
name = strings.ReplaceAll(name, "\\", "")
return name
}