1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-03-17 21:18:19 +02:00

Bugfix: Append trailing slash to custom webroot for UI & API

Fixes #25
This commit is contained in:
Ralph Slooten 2022-12-08 09:54:03 +13:00
parent 06aa7a2dea
commit 5f9efebeb3

View File

@ -160,11 +160,12 @@ func VerifyConfig() error {
SMTPAuth = a
}
if strings.Contains(Webroot, " ") {
return fmt.Errorf("Webroot cannot contain spaces (%s)", Webroot)
validWebrootRe := regexp.MustCompile(`[^0-9a-zA-Z\/-]`)
if validWebrootRe.MatchString(Webroot) {
return fmt.Errorf("Invalid characters in Webroot (%s). Valid chars: a-z, A-Z, 0-9, - and /", Webroot)
}
s := path.Join("/", Webroot, "/")
s := strings.TrimRight(path.Join("/", Webroot, "/"), "/") + "/"
Webroot = s
SMTPTags = []Tag{}