[IMP] core: broken symbols on upload

closes odoo/odoo#64920

X-original-commit: 9ea507358f21ad836970610fd384dd41e39b99ef
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Xavier Morel
2021-01-22 11:51:54 +00:00
committed by std-odoo
parent 859da10dc2
commit 60ffb6854b
+4 -3
View File
@@ -102,6 +102,7 @@ db_list = http.db_list
db_monodb = http.db_monodb
def clean(name): return name.replace('\x3c', '')
def serialize_exception(f):
@functools.wraps(f)
def wrap(*args, **kwargs):
@@ -1566,7 +1567,7 @@ class Binary(http.Controller):
ufile.content_type, pycompat.to_text(base64.b64encode(data))]
except Exception as e:
args = [False, str(e)]
return out % (json.dumps(callback), json.dumps(args)) if callback else json.dumps(args)
return out % (json.dumps(clean(callback)), json.dumps(args)) if callback else json.dumps(args)
@http.route('/web/binary/upload_attachment', type='http', auth="user")
@serialize_exception
@@ -1599,12 +1600,12 @@ class Binary(http.Controller):
_logger.exception("Fail to upload attachment %s" % ufile.filename)
else:
args.append({
'filename': filename,
'filename': clean(filename),
'mimetype': ufile.content_type,
'id': attachment.id,
'size': attachment.file_size
})
return out % (json.dumps(callback), json.dumps(args)) if callback else json.dumps(args)
return out % (json.dumps(clean(callback)), json.dumps(args)) if callback else json.dumps(args)
@http.route([
'/web/binary/company_logo',