diff --git a/downloader/download_downloadr.go b/downloader/download_downloadr.go index c44f796..368528b 100644 --- a/downloader/download_downloadr.go +++ b/downloader/download_downloadr.go @@ -6,6 +6,7 @@ import ( "log" "os" "path/filepath" + "regexp" "strings" "github.com/gen2brain/beeep" @@ -78,11 +79,10 @@ func DownloadR(url string) error { return nil } +var re = regexp.MustCompile(`[#!$%&/()";:?;,]`) + func Sanitize(s string) string { s = strings.ReplaceAll(s, "&", "and") - s = strings.ReplaceAll(s, "?", "") - s = strings.ReplaceAll(s, ":", "") - s = strings.ReplaceAll(s, ";", "") - s = strings.ReplaceAll(s, ",", "") + s = re.ReplaceAllString(s, "") return s }