summaryrefslogtreecommitdiff
path: root/addons/mail/controllers/main.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2014-05-07 18:00:23 +0200
committerChristophe Simonis <chs@openerp.com>2014-05-07 18:00:23 +0200
commit1091b24a0c659e6e7ad3ca0d6ba7141617ddcb4c (patch)
tree142b61f0833a0224dec04d3ee5f6c03c44304001 /addons/mail/controllers/main.py
parent643871c20f096223b38ef69e846dcaa9f1e44051 (diff)
parent1953aa442fb2f6cc4d0e64bbfcc1f9a461f14a02 (diff)
[MERGE] forward port of branch saas-3 up to revid 9450 chs@openerp.com-20140507153348-g2qw61dkxvps13br
bzr revid: chs@openerp.com-20140507160023-8wwqlbf3bv7yqe67
Diffstat (limited to 'addons/mail/controllers/main.py')
-rw-r--r--addons/mail/controllers/main.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index a913d3c067d..4a069cb5428 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -6,6 +6,7 @@ from openerp import SUPERUSER_ID
from openerp import http
from openerp.http import request
from openerp.addons.web.controllers.main import content_disposition
+import mimetypes
class MailController(http.Controller):
@@ -19,10 +20,11 @@ class MailController(http.Controller):
if res:
filecontent = base64.b64decode(res.get('base64'))
filename = res.get('filename')
+ content_type = mimetypes.guess_type(filename)
if filecontent and filename:
return request.make_response(
filecontent,
- headers=[('Content-Type', 'application/octet-stream'),
+ headers=[('Content-Type', content_type[0] or 'application/octet-stream'),
('Content-Disposition', content_disposition(filename))])
return request.not_found()