package main import ( "net/url" "regexp" "strings" ) func sanitizeFilename(filename string) string { filename = regexp.MustCompile(`[<>:"/\\|?*]`).ReplaceAllString(filename, "_") filename = strings.Trim(filename, ".") return filename } func isValidURL(toTest string) bool { _, err := url.ParseRequestURI(toTest) return err == nil }