From 560c832cc6657434ab5bd7df8f91631f030f7eec Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 19 Oct 2020 16:13:59 -0700 Subject: [PATCH] Apply timezone cleaning to final result, closes #2546 --- config/config_system.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/config_system.go b/config/config_system.go index 2877197..b84d00b 100644 --- a/config/config_system.go +++ b/config/config_system.go @@ -211,12 +211,14 @@ func (sc *SystemConfiguration) ConfigureTimezone() error { return nil } - sc.Timezone = regexp.MustCompile(`\s+$`).ReplaceAllString(string(matches[1]), "") + sc.Timezone = string(matches[1]) } else { sc.Timezone = string(b) } } + sc.Timezone = regexp.MustCompile(`[^a-z_/]+/i`).ReplaceAllString(sc.Timezone, "") + _, err := time.LoadLocation(sc.Timezone) return errors.Wrap(err, fmt.Sprintf("the supplied timezone %s is invalid", sc.Timezone))