DRMDTool/utils.go

21 lines
345 B
Go
Raw Normal View History

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
}