Skip to content
Browse files

Fixed #11030: fixed file uploads on non-utf8 filesystem encoding. Tha…

…nks, Honza Kral.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent fb9ac57 commit a59095af24bb64a025ce99de3555f2a21da7a2e8 @jacobian jacobian committed
4 django/core/files/
@@ -6,7 +6,7 @@
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
from django.core.files import locks, File
from django.core.files.move import file_move_safe
-from django.utils.encoding import force_unicode
+from django.utils.encoding import force_unicode, smart_str
from django.utils.functional import LazyObject
from django.utils.importlib import import_module
from django.utils.text import get_valid_filename
@@ -212,7 +212,7 @@ def path(self, name):
path = safe_join(self.location, name)
except ValueError:
raise SuspiciousOperation("Attempted access to '%s' denied." % name)
- return os.path.normpath(path)
+ return smart_str(os.path.normpath(path))
def size(self, name):
return os.path.getsize(self.path(name))
4 tests/modeltests/files/
@@ -70,13 +70,13 @@ def random_upload_to(self, filename):
>>> files.sort()
>>> files
-[u'default.txt', u'django_test.txt']
+['default.txt', 'django_test.txt']
>>> dirs, files = temp_storage.listdir('tests')
>>> files.sort()
>>> files
-[u'assignment.txt', u'default.txt', u'django_test.txt']
+['assignment.txt', 'default.txt', 'django_test.txt']
# Files can be read in a little at a time, if necessary.

0 comments on commit a59095a

Please sign in to comment.
Something went wrong with that request. Please try again.