mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[py3] Encoded value before feeding it to hashlib.md5
This commit is contained in:
3
django/core/cache/backends/filebased.py
vendored
3
django/core/cache/backends/filebased.py
vendored
@@ -10,6 +10,7 @@ except ImportError:
|
||||
import pickle
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
from django.utils.encoding import smart_bytes
|
||||
|
||||
class FileBasedCache(BaseCache):
|
||||
def __init__(self, dir, params):
|
||||
@@ -136,7 +137,7 @@ class FileBasedCache(BaseCache):
|
||||
Thus, a cache key of "foo" gets turnned into a file named
|
||||
``{cache-dir}ac/bd/18db4cc2f85cedef654fccc4a4d8``.
|
||||
"""
|
||||
path = hashlib.md5(key).hexdigest()
|
||||
path = hashlib.md5(smart_bytes(key)).hexdigest()
|
||||
path = os.path.join(path[:2], path[2:4], path[4:])
|
||||
return os.path.join(self._dir, path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user