feature: added ReplaceAllRestrictedCharactersNoSlashes method

master
amorozov 2024-09-19 17:27:13 +03:00
parent 0b2540924b
commit dd34bd7595
1 changed files with 11 additions and 0 deletions

View File

@ -61,6 +61,17 @@ func ReplaceAllRestrictedCharacters(filePath string) string {
return filePath
}
func ReplaceAllRestrictedCharactersNoSlashes(filePath string) string {
for k, v := range RestrictedFilepathCharactersReplacements {
if k == "\\" || k == "/" {
continue
}
filePath = strings.ReplaceAll(filePath, k, v)
}
return filePath
}
func TryAbs(filePath string) string {
if !filepath.IsAbs(filePath) {
abs, err := filepath.Abs(filePath)