David Bennett committed af119e9

Don't mess with url quoting until I have a test showing that I actually need it...

Comments (0)

Files changed (3)


 from django.core.urlresolvers import reverse
 from django.db.models.fields import files
 from private_media.conf import settings
-from private_media.utils import encode_key, urlquote
+from private_media.utils import encode_key
 class PrivateFieldFile(files.FieldFile):
         key = (
-            urlquote(, safe=''),
+  ,
         if settings.PRIVATE_MEDIA_ENCODE_URL:


 from base64 import urlsafe_b64encode, urlsafe_b64decode
 from itertools import izip, cycle
-from urllib import unquote
-from django.utils.http import urlquote, force_unicode, smart_str, allow_lazy
 from private_media.conf import settings
-assert urlquote
 def xor_crypt_string(data, key=None):
 def decode_key(key):
     return xor_crypt_string(urlsafe_b64decode(str(key) + '=='))
-def urlunquote(quoted_url):
-    """
-    A wrapper for Python's urllib.unquote() function that can operate on
-    the result of django.utils.http.urlquote().
-    """
-    return force_unicode(unquote(smart_str(quoted_url)))
-urlunquote = allow_lazy(urlunquote, unicode)


 from django.http import Http404
 from django.views.static import serve
 from private_media.conf import settings
-from private_media.utils import decode_key, urlunquote
+from private_media.utils import decode_key
 def get_file(request, content_type_id, object_pk, field_name, file_name):
         key = decode_key(enc_key)
         content_type_id, object_pk, field_name = key.split('/', 2)
-        object_pk = urlunquote(object_pk)
     except Exception, e:
         raise Http404(e if settings.DEBUG else 'File not found.')
     return get_file(request, content_type_id, object_pk, field_name, file_name)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.