[MERGE] forward port branch 9.0 up to c9e7433c23
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user