mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 10:00:01 +00:00
Add ascii check in User.by_username to fix mysql errors
This commit is contained in:
parent
1bc21bc599
commit
89590c91bb
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue