Fix: limit the id sizes we generate and remove spaces after unidecode

This commit is contained in:
Adrià Casajús 2024-01-22 17:42:58 +01:00
parent da09db3864
commit c3848862c3
No known key found for this signature in database
GPG Key ID: F0033226A5AFC9B9
1 changed files with 2 additions and 2 deletions

View File

@ -49,11 +49,11 @@ def random_string(length=10, include_digits=False):
def convert_to_id(s: str):
"""convert a string to id-like: remove space, remove special accent"""
s = s.replace(" ", "")
s = s.lower()
s = unidecode(s)
s = s.replace(" ", "")
return s
return s[:256]
_ALLOWED_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-."