Betterify sanitization

This commit is contained in:
2024-11-05 16:03:32 +01:00
parent 8ab4b4c280
commit 9b38ea7068

View File

@@ -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
}