Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

fix error when video path has []

scwf85aa2591ca01
diff --git a/pkg/util/base.go b/pkg/util/base.go
index c0635551..2792c6d6 100644
--- a/pkg/util/base.go
+++ b/pkg/util/base.go
@@ -193,11 +193,11 @@ func CopyFile(src, dst string) error {
func SanitizePathName(name string) string {
var illegalChars *regexp.Regexp
if runtime.GOOS == "windows" {
- // Windows 特殊字符
- illegalChars = regexp.MustCompile(`[<>:"/\\|?*\x00-\x1F]`)
+ // Windows 特殊字符,包括方括号(会影响 filepath.Glob)
+ illegalChars = regexp.MustCompile(`[<>:"/\\|?*\[\]\x00-\x1F]`)
} else {
- // POSIX 系统:只禁用 / 和空字节
- illegalChars = regexp.MustCompile(`[/\x00]`)
+ // POSIX 系统:禁用 /、空字节和方括号(会影响 filepath.Glob)
+ illegalChars = regexp.MustCompile(`[/\[\]\x00]`)
}
sanitized := illegalChars.ReplaceAllString(name, "_")