1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 04:20:00 +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
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()
return user