mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
config.go: add http prefix to ORIGIN and CDN_PREFIX
This commit is contained in:
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var prePlusMatch = regexp.MustCompile(`([^@\+]*)\+?(.*)@.*`)
|
||||
@ -43,3 +44,11 @@ func isHttpsUrl(in string) bool {
|
||||
// solves this. If this function returns false, prefix with "http://"
|
||||
return len(httpsUrl.FindAllString(in, -1)) != 0
|
||||
}
|
||||
|
||||
func addHttpIfAbsent(in string) string {
|
||||
if !strings.HasPrefix(in, "http://") && !strings.HasPrefix(in, "https://") {
|
||||
return "http://" + in
|
||||
}
|
||||
|
||||
return in
|
||||
}
|
||||
|
Reference in New Issue
Block a user