Open RevenantOne opened 1 year ago
I have the same issue.
To reproduce the issue, the podcast "Dumb-Dumbs - Dragons- A Dungeons - Dragons Podcast" can be used, it have 13 episodes with asterisks in their name (the first one is: 2017-10-17-2-08-F***-Harness.mp3)
I'm not a go programmer, but a solution could be to add some regex replace inside cleanFileName() (line #401 of podgrab/service/fileService.go)
Something like:
newString := sanitize.Name(original)
re, err := regexp.Compile(`[<>:"/\\|?*]`)
if err != nil {
log.Fatal(err)
}
newString := re.ReplaceAllString(newString, "_")
I tested it on https://go.dev/play/ https://go.dev/play/p/QMbwRn8xJ_g
package main
import (
"fmt"
"log"
"regexp"
)
func main() {
str1 := "The / is illegal in Linux, and the following are illegal in Windows: * . \" / \\ [ ] : ; | ,"
re, err := regexp.Compile(`[<>:"/\\|?*]`)
if err != nil {
log.Fatal(err)
}
str1 = re.ReplaceAllString(str1, "_")
fmt.Println(str1)
}
of course, adding it in an if statement, that match a setting tick box, would be better.
Please complete the following information
Describe the bug PodGrab uses invalid characters in filenames.
To Reproduce Steps to reproduce the behavior:
Expected behavior An option to sanitise filenames to ensure no invalid characters can be used, regardless of operating system.
Screenshots N/A
Additional context I'm running PodGrab on a Ubuntu server and trying to sync to a Windows machine but it fails as episode names contain asterisks (*). Renaming files to remove invalid characters is redundant as PodGrab will rename them back to their original name.