#22911 closed Bug (duplicate)
Non-ASCII filename uploaded by user crashed Django
Reported by: | lvella | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a file field on a model editable by the admin interface. Today the tried to upload a file including the character 'ç', for what the server sent me the following message (possibly related with the fact I am using Python 3.4):
Traceback (most recent call last): File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 114, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 430, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 99, in _wrapped_view response = view_func(request, *args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/views/decorators/cache.py", line 52, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/contrib/admin/sites.py", line 198, in inner return view(request, *args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 29, in _wrapper return bound_func(*args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 99, in _wrapped_view response = view_func(request, *args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 25, in bound_func return func(self, *args2, **kwargs2) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/transaction.py", line 339, in inner return func(*args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 1228, in change_view self.save_model(request, new_object, form, True) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 858, in save_model obj.save() File "./company/models.py", line 53, in save super(Company, self).save(*args, **kwargs) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/models/base.py", line 545, in save force_update=force_update, update_fields=update_fields) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/models/base.py", line 573, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/models/base.py", line 632, in _save_table for f in non_pks] File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/models/base.py", line 632, in <listcomp> for f in non_pks] File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/models/fields/files.py", line 252, in pre_save file.save(file.name, file, save=False) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/db/models/fields/files.py", line 86, in save self.name = self.storage.save(name, content) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/core/files/storage.py", line 48, in save name = self.get_available_name(name) File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/core/files/storage.py", line 74, in get_available_name while self.exists(name): File "/home/fidelidade/fidelidade/venv/lib/python3.4/site-packages/django/core/files/storage.py", line 245, in exists return os.path.exists(self.path(name)) File "/home/fidelidade/fidelidade/venv/lib/python3.4/genericpath.py", line 19, in exists os.stat(path) UnicodeEncodeError: 'ascii' codec can't encode character '\xe7' in position 48: ordinal not in range(128)
Change History (2)
comment:1 by , 10 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I believe this a duplicate of #17686 and #9696.