1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 15:00:01 +00:00

Add ascii check in User.by_username to fix mysql errors

This commit is contained in:
nyaadev 2017-09-18 13:28:15 +02:00
parent 1bc21bc599
commit 89590c91bb

View file

@ -569,6 +569,10 @@ class User(db.Model):
@classmethod @classmethod
def by_username(cls, username): def by_username(cls, username):
isascii = lambda s: len(s) == len(s.encode())
if not isascii(username):
return None
user = cls.query.filter_by(username=username).first() user = cls.query.filter_by(username=username).first()
return user return user