Truncate overlong titles instead of hashing, which behaved inconsistently
This commit is contained in:
parent
590bf958de
commit
a18b16baac
|
@ -19,8 +19,7 @@ def titleescape(s):
|
||||||
s = re.sub(r"\s+", '_', s) # Replace whitespace with _
|
s = re.sub(r"\s+", '_', s) # Replace whitespace with _
|
||||||
s = parse.quote(s) # Encode all other characters
|
s = parse.quote(s) # Encode all other characters
|
||||||
s = re.sub(r"%", "", s) # Strip encoding %s
|
s = re.sub(r"%", "", s) # Strip encoding %s
|
||||||
if len(s) > 64: # If the result is unreasonably long,
|
s = s[:64] # Limit to 64 characters
|
||||||
s = hex(abs(hash(s)))[2:] # Replace it with a hex hash
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def titlesort(s):
|
def titlesort(s):
|
||||||
|
|
Loading…
Reference in New Issue