Apply timezone cleaning to final result, closes #2546

This commit is contained in:
Dane Everitt 2020-10-19 16:13:59 -07:00
parent 13058ad64b
commit 560c832cc6
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -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))