From 542793260b196d6180065fad5e817891919214b6 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Thu, 27 Sep 2018 14:53:23 +0200 Subject: [PATCH] Handle wildcard aliases using podop --- core/admin/mailu/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index ec94f989..1bcc4e9f 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -341,8 +341,13 @@ class Alias(Base, Email): return cls.query.filter( sqlalchemy.and_(cls.domain_name == domain_name, sqlalchemy.or_( - cls.localpart == localpart, - cls.wildcard.like(localpart) + sqlalchemy.and_( + cls.wildcard == False, + cls.localpart == localpart + ), sqlalchemy.and_( + cls.wildcard == True, + sqlalchemy.bindparam("l", localpart).like(cls.localpart) + ) ) ) ).first()