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.
TypeScript agent-skillscodex-clideskop-appdubbingimage-generationlocalizationskillsttsvideo-editingvideo-generationvideo-transcriptionvideo-translation
fix: handle the '?' in taksid
puji4810a25087bf1cb0
diff --git a/internal/service/subtitle_service.go b/internal/service/subtitle_service.goindex d2f46cb8..44c71627 100644--- a/internal/service/subtitle_service.go+++ b/internal/service/subtitle_service.go@@ -4,8 +4,6 @@ import ("context""errors""fmt"- "github.com/samber/lo"- "go.uber.org/zap""krillin-ai/internal/dto""krillin-ai/internal/storage""krillin-ai/internal/types"@@ -15,6 +13,8 @@ import ("path/filepath""runtime""strings"+ "github.com/samber/lo"+ "go.uber.org/zap")func (s Service) StartSubtitleTask(req dto.StartVideoSubtitleTaskReq) (*dto.StartVideoSubtitleTaskResData, error) {@@ -35,6 +35,7 @@ func (s Service) StartSubtitleTask(req dto.StartVideoSubtitleTaskReq) (*dto.Starseperates := strings.Split(req.Url, "/")taskId := fmt.Sprintf("%s_%s", util.SanitizePathName(string([]rune(strings.ReplaceAll(seperates[len(seperates)-1], " ", ""))[:16])), util.GenerateRandStringWithUpperLowerNum(4))taskId = strings.ReplaceAll(taskId, "=", "") // 等于号影响ffmpeg处理+ taskId = strings.ReplaceAll(taskId, "?", "") // 问号影响ffmpeg处理// 构造任务所需参数var resultType types.SubtitleResultType// 根据入参选项确定要返回的字幕类型diff --git a/pkg/util/base.go b/pkg/util/base.goindex 761f143c..0adb56e8 100644--- a/pkg/util/base.go+++ b/pkg/util/base.go@@ -198,8 +198,8 @@ func SanitizePathName(name string) string {// Windows 特殊字符,包括方括号(会影响 filepath.Glob)illegalChars = regexp.MustCompile(`[<>:"/\\|?*\[\]\x00-\x1F]`)} else {- // POSIX 系统:禁用 /、空字节和方括号(会影响 filepath.Glob)- illegalChars = regexp.MustCompile(`[/\[\]\x00]`)+ // POSIX 系统:禁用 /、空字节、方括号和问号(会影响 filepath.Glob 和 ffmpeg)+ illegalChars = regexp.MustCompile(`[/\[\]\x00?]`)}sanitized := illegalChars.ReplaceAllString(name, "_")