Fix: limit the id sizes we generate and remove spaces after unidecode
This commit is contained in:
parent
da09db3864
commit
c3848862c3
|
@ -49,11 +49,11 @@ def random_string(length=10, include_digits=False):
|
||||||
|
|
||||||
def convert_to_id(s: str):
|
def convert_to_id(s: str):
|
||||||
"""convert a string to id-like: remove space, remove special accent"""
|
"""convert a string to id-like: remove space, remove special accent"""
|
||||||
s = s.replace(" ", "")
|
|
||||||
s = s.lower()
|
s = s.lower()
|
||||||
s = unidecode(s)
|
s = unidecode(s)
|
||||||
|
s = s.replace(" ", "")
|
||||||
|
|
||||||
return s
|
return s[:256]
|
||||||
|
|
||||||
|
|
||||||
_ALLOWED_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-."
|
_ALLOWED_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-."
|
||||||
|
|
Loading…
Reference in New Issue