mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 18:10:29 +00:00
fix: repair invalid filename (#296)
This commit is contained in:
6 files changed
+74
No files matched your search
@@ -183,3 +183,14 @@ func IsExistsFile(path string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ReplaceInvalidFilename replace invalid path characters
|
||||
func ReplaceInvalidFilename(path string) string {
|
||||
if path == "" {
|
||||
return ""
|
||||
}
|
||||
for _, char := range invalidPathChars {
|
||||
path = strings.ReplaceAll(path, char, "_")
|
||||
}
|
||||
return path
|
||||
}
|
||||
Reference in new issue
Block a user