diff photologue/models.py @ 151:762e46d0bb4a

urlquote photologue filenames when building URLs.
author Brian Neal <bgneal@gmail.com>
date Wed, 30 Jul 2014 20:07:21 -0500
parents dcd097a59223
children f3eca817dd33
line wrap: on
line diff
--- a/photologue/models.py	Fri Jul 04 14:25:36 2014 -0500
+++ b/photologue/models.py	Wed Jul 30 20:07:21 2014 -0500
@@ -13,6 +13,7 @@
 from django.utils.text import slugify
 from django.utils.functional import curry
 from django.utils.translation import ugettext_lazy as _
+from django.utils.http import urlquote
 
 # Required PIL classes may or may not be available from the root namespace
 # depending on the installation method used.
@@ -306,7 +307,8 @@
         if photosize.increment_count:
             self.view_count += 1
             self.save(update=True)
-        return '/'.join([self.cache_url(), self._get_filename_for_size(photosize.name)])
+        return '/'.join([self.cache_url(),
+            urlquote(self._get_filename_for_size(photosize.name))])
 
     def _get_SIZE_filename(self, size):
         photosize = PhotoSizeCache().sizes.get(size)