Opened 18 years ago
Closed 15 years ago
#3211 closed defect (fixed)
admin crash when uploading an e-mail message as a text file
Reported by: | Antti Kaihola | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | gt4329b@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In r4259, if I try to upload an e-mail message saved from Mozilla Thunderbird (an .eml file) in admin, I get this error message:
Traceback (most recent call last): File "/django/core/servers/basehttp.py", line 272, in run self.result = application(self.environ, self.start_response) File "/django/core/servers/basehttp.py", line 614, in __call__ return self.application(environ, start_response) File "/django/core/handlers/wsgi.py", line 189, in __call__ response = self.get_response(request) File "/django/core/handlers/base.py", line 111, in get_response return debug.technical_500_response(request, *sys.exc_info()) File "/django/views/debug.py", line 131, in technical_500_response return HttpResponseServerError(t.render(c), mimetype='text/html') File "/django/template/__init__.py", line 160, in render return self.nodelist.render(context) File "/django/template/__init__.py", line 694, in render bits.append(self.render_node(node, context)) File "/django/template/__init__.py", line 722, in render_node raise wrapped TemplateSyntaxError: Caught an exception while rendering: Nested MIME messages are not supported Original Traceback (most recent call last): File "/django/template/__init__.py", line 712, in render_node result = node.render(context) File "/django/template/__init__.py", line 762, in render output = self.filter_expression.resolve(context) File "/django/template/__init__.py", line 555, in resolve obj = resolve_variable(self.var, context) File "/django/template/__init__.py", line 640, in resolve_variable current = current[bits[0]] File "/django/http/__init__.py", line 31, in __getitem__ for d in (self.POST, self.GET): File "/django/core/handlers/wsgi.py", line 136, in _get_post self._load_post_and_files() File "/django/core/handlers/wsgi.py", line 114, in _load_post_and_files self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data) File "/django/http/__init__.py", line 61, in parse_file_upload assert type([]) != type(submessage.get_payload()), "Nested MIME messages are not supported" AssertionError: Nested MIME messages are not supported
Here's my model:
class EmailUploadBugTestModel(models.Model): upload = models.FileField(upload_to='files/%Y/%m/%d') class Admin: pass
Attachments (1)
Change History (5)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 17 years ago
Cc: | added |
---|---|
Has patch: | set |
Patch needs improvement: | set |
I recently ran into the same problem, so I came up with my own monkeypatch for handling message/rfc822
content types (nested MIME messages). Make no mistake: it's a hack, as it just removes the blind assert and replaces it with handling code that grabs the first payload from the submessage.
by , 17 years ago
Attachment: | allow_MHTML_upload_patch.r6660.diff added |
---|
comment:4 by , 15 years ago
Has patch: | unset |
---|---|
Patch needs improvement: | unset |
Resolution: | → fixed |
Status: | new → closed |
This has been fixed at some point between this bug being filed and now. There no longer are checks for nested mime messages and uploading .eml files with embedded emails works as expected.
My browser is Firefox 2.0, in case that makes any difference.