1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-01-26 03:52:09 +02:00

Feature: Expand custom webroot path to include a-z A-Z 0-9 _ . - and /

@see #64
This commit is contained in:
Ralph Slooten 2023-03-10 14:48:28 +13:00
parent 7675cd162f
commit b905ba4ec5

View File

@ -160,9 +160,9 @@ func VerifyConfig() error {
SMTPAuth = a
}
validWebrootRe := regexp.MustCompile(`[^0-9a-zA-Z\/-]`)
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)
return fmt.Errorf("Invalid characters in Webroot (%s). Valid chars include: [a-z A-Z 0-9 _ . - /]", Webroot)
}
s := strings.TrimRight(path.Join("/", Webroot, "/"), "/") + "/"