#9696: FileField raises unhandled exception when filename contains non-ascii
characters
-------------------------------------------+--------------------------------
Reporter: magarac | Owner: nobody
Status: reopened | Milestone: 1.1
Component: File uploads/storage | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by oyiptong):
I have this issue as well.
I reproduced this by uploading a file with a filename containing unicode
characters: "Peña.cbz"
{{{
Environment:
Request Method: POST
Request URL: http://staging.getcomicstrips.com/library/upload
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'getcomics.library',
'getcomics.downloader',
'getcomics.rest_ws',
'getcomics.jobserver']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in
get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/auth/decorators.py"
in __call__
67. return self.view_func(request, *args, **kwargs)
File
"/u/apps/getcomics/releases/20090325215603/getcomics/../getcomics/library/views.py"
in user_upload
50. pub = new_form.save()
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in save
319. return save_instance(self, self.instance,
self._meta.fields, fail_message, commit)
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in
save_instance
61. f.save_form_data(instance, cleaned_data[f.name])
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py"
in save_form_data
192. getattr(instance, self.name).save(data.name, data,
save=False)
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py"
in save
74. self._name = self.storage.save(name, content)
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in
save
44. name = self.get_available_name(name)
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in
get_available_name
66. while self.exists(name):
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in
exists
188. return os.path.exists(self.path(name))
File "/usr/lib/python2.5/posixpath.py" in exists
171. st = os.stat(path)
Exception Type: UnicodeEncodeError at /library/upload
Exception Value: 'ascii' codec can't encode character u'\xf1' in position
49: ordinal not in range(128)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/9696#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---