data sources: use bytes to generate hash for cache key (#36515)

This commit is contained in:
Frédéric Péters 2019-11-15 22:40:59 +01:00
parent a549bf930c
commit 75644e0e50
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ import hashlib
import xml.etree.ElementTree as ET
from django.utils import six
from django.utils.encoding import force_text
from django.utils.encoding import force_text, force_bytes
from django.utils.six.moves.urllib import parse as urllib
from django.utils.six.moves.urllib import parse as urlparse
@ -189,7 +189,7 @@ def get_structured_items(data_source, mode=None):
return request.datasources_cache[url]
if cache_duration:
cache_key = 'data-source-%s' % hashlib.md5(url).hexdigest()
cache_key = 'data-source-%s' % force_str(hashlib.md5(force_bytes(url)).hexdigest())
from django.core.cache import cache
items = cache.get(cache_key)
if items is not None: