fixed the notification service error when the user's display name contained special characters
This commit is contained in:
@@ -3,6 +3,8 @@ package parser
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"strings"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
@@ -54,6 +56,17 @@ func Validate(cfg *config.Config) error {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if strings.TrimSpace(cfg.Notifications.SMTP.Sender) == "" {
|
||||
return fmt.Errorf("the 'smtp_sender' must be a valid single RFC 5322 address. parsing error: the address cannot be empty")
|
||||
}
|
||||
if s, err := mail.ParseAddress(cfg.Notifications.SMTP.Sender); err == nil {
|
||||
cfg.Notifications.SMTP.Sender = s.String()
|
||||
} else {
|
||||
return fmt.Errorf("the 'smtp_sender' must be a valid single RFC 5322 address. parsing error %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.ServiceAccount.ServiceAccountID == "" {
|
||||
return shared.MissingServiceAccountID(cfg.Service.Name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user