From 9fd88bd6bce6dac5c8ff1f98f314e6b43028caf7 Mon Sep 17 00:00:00 2001 From: Azareal Date: Thu, 13 Aug 2020 09:46:10 +1000 Subject: [PATCH] verify Site.URL on start-up --- common/site.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/site.go b/common/site.go index e8d1adb9..ecb6361d 100644 --- a/common/site.go +++ b/common/site.go @@ -199,6 +199,10 @@ func ProcessConfig() (err error) { Site.URL = strings.TrimSuffix(Site.URL, ":") Site.URL = Site.URL + ":" + Site.Port } + uurl, err := url.Parse(Site.URL) + if err != nil { + return errors.Wrap(err, "failed to parse Site.URL: ") + } if Site.EnableSsl { Config.SslSchema = Site.EnableSsl } @@ -237,7 +241,7 @@ func ProcessConfig() (err error) { local := func(h string) bool { return h == "localhost" || h == "127.0.0.1" || h == "::1" || h == Site.URL } - uurl, err := url.Parse(Config.StaticResBase) + uurl, err = url.Parse(Config.StaticResBase) if err != nil { return errors.Wrap(err, "failed to parse Config.StaticResBase: ") }