[py3] Pass bytes to md5 in truncate_name
This commit is contained in:
parent
2d2dca2d8e
commit
187ec5a166
|
@ -6,6 +6,7 @@ import hashlib
|
|||
from time import time
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.encoding import smart_bytes
|
||||
from django.utils.log import getLogger
|
||||
from django.utils.timezone import utc
|
||||
|
||||
|
@ -137,7 +138,7 @@ def truncate_name(name, length=None, hash_len=4):
|
|||
if length is None or len(name) <= length:
|
||||
return name
|
||||
|
||||
hsh = hashlib.md5(name).hexdigest()[:hash_len]
|
||||
hsh = hashlib.md5(smart_bytes(name)).hexdigest()[:hash_len]
|
||||
return '%s%s' % (name[:length-hash_len], hsh)
|
||||
|
||||
def format_number(value, max_digits, decimal_places):
|
||||
|
|
Loading…
Reference in New Issue