Skip to content

Commit 0c40fa2

Browse files
committed
Add formating for subtitle name in export job
Replace "\" and "/" with "|" in subtitle name as it collides with filepath.
1 parent 9f8b9fa commit 0c40fa2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

internal/jobs/export/export.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,14 @@ func handleSubtitle(subtitleEntry *ent.SubtitleSchema, ctx context.Context, logg
186186
logger.Error("cannot get subtitle video", "err", err)
187187
}
188188

189+
title := strings.ReplaceAll(strings.ReplaceAll(subtitleEntry.Title, "/", "|"), "\\", "|")
190+
189191
exportFilepath := filepath.Join(
190192
filepath.Dir(videoEntry.Filepath),
191193
strings.TrimSuffix(
192194
filepath.Base(videoEntry.Filepath),
193195
filepath.Ext(videoEntry.Filepath),
194-
)+"."+subtitleEntry.Title+"."+groupConfig.Config.Format.FileExt(),
196+
)+"."+title+"."+groupConfig.Config.Format.FileExt(),
195197
)
196198

197199
if _, err := os.Stat(exportFilepath); err == nil {

0 commit comments

Comments
 (0)