Clean file path names on file creation (#624)
This commit is contained in:
19
internal/git/file.go
Normal file
19
internal/git/file.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user