summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-23 14:07:12 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-23 14:07:12 +0200
commit2d12ae3202ed93a12e1f8ff59bf64e82c0c98871 (patch)
treecbcbd8258076f6cda4696852a9b93ee389d50aa1 /addons/web/controllers/main.py
parent6157750a662a4b81e6e094a161f5b12e6ceb080a (diff)
parentc9e7433c23712f41fa2a93f3ee6464eb94173608 (diff)
[MERGE] forward port branch 9.0 up to c9e7433c237
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 6122b00e0ed..5408b9f159e 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -24,6 +24,7 @@ import werkzeug.wrappers
import zlib
from xml.etree import ElementTree
from cStringIO import StringIO
+import unicodedata
import odoo
@@ -1066,16 +1067,23 @@ class Binary(http.Controller):
var win = window.top.window;
win.jQuery(win).trigger(%s, %s);
</script>"""
+
+ filename = ufile.filename
+ if request.httprequest.user_agent.browser == 'safari':
+ # Safari sends NFD UTF-8 (where é is composed by 'e' and [accent])
+ # we need to send it the same stuff, otherwise it'll fail
+ filename = unicodedata.normalize('NFD', ufile.filename).encode('UTF-8')
+
try:
attachment = Model.create({
- 'name': ufile.filename,
+ 'name': filename,
'datas': base64.encodestring(ufile.read()),
- 'datas_fname': ufile.filename,
+ 'datas_fname': filename,
'res_model': model,
'res_id': int(id)
})
args = {
- 'filename': ufile.filename,
+ 'filename': filename,
'mimetype': ufile.content_type,
'id': attachment.id
}