21 lines
345 B
Go
21 lines
345 B
Go
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
|
|
}
|