Fix incorrectly case sensitive username finding in db. Fixes #384

This commit is contained in:
Tulir Asokan
2019-11-30 15:21:47 +02:00
parent 25d7087d07
commit 91e6a73f33
6 changed files with 15 additions and 9 deletions
+2 -2
View File
@@ -15,7 +15,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Optional
from sqlalchemy import Column, Integer, String, Boolean, Text
from sqlalchemy import Column, Integer, String, Boolean, Text, func
from mautrix.types import RoomID
from mautrix.util.db import Base
@@ -53,4 +53,4 @@ class Portal(Base):
@classmethod
def get_by_username(cls, username: str) -> Optional['Portal']:
return cls._select_one_or_none(cls.c.username == username)
return cls._select_one_or_none(func.lower(cls.c.username) == username)