Skip to content

Commit

Permalink
Avoid errors in some versions of memcached that don't handle invalid …
Browse files Browse the repository at this point in the history
…characters
  • Loading branch information
maxicecilia committed May 28, 2017
1 parent 0bae2c8 commit 10b83c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django_dropbox/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from django.core.files import File
from django.core.files.storage import Storage
from django.utils.deconstruct import deconstructible
from django.utils.encoding import filepath_to_uri

from .settings import ACCESS_TOKEN, CACHE_TIMEOUT, SHARE_LINK_CACHE_TIMEOUT

Expand Down Expand Up @@ -75,7 +76,7 @@ def listdir(self, path):
return directories, files

def size(self, name):
cache_key = 'django-dropbox-size:%s' % name
cache_key = 'django-dropbox-size:{}'.format(filepath_to_uri(name))
size = cache.get(cache_key)

if not size:
Expand All @@ -84,7 +85,7 @@ def size(self, name):
return size

def url(self, name):
cache_key = 'django-dropbox-url:%s' % name
cache_key = 'django-dropbox-size:{}'.format(filepath_to_uri(name))
url = cache.get(cache_key)

if not url:
Expand Down

0 comments on commit 10b83c3

Please sign in to comment.