diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-06-21 10:57:42 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-06-21 10:57:42 +0200 |
| commit | c5ed37297098c48bf6a89a2175127541ad1f5da3 (patch) | |
| tree | 48ec8c4bbb2f300a4c97988cdb7c47990ddc691b /addons/web_editor | |
| parent | 1fe119da3bfef23b71bb4138f985cf704d23d5ea (diff) | |
| parent | 152d42041e7c3d57104d001a826fd2458136a8d6 (diff) | |
[MERGE] forward port branch saas-15 up to 152d42041e7
Diffstat (limited to 'addons/web_editor')
| -rw-r--r-- | addons/web_editor/controllers/main.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index 91b698bf03a..c3f11def23b 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -361,16 +361,17 @@ class Web_Editor(http.Controller): # Check if the file to save had already been modified custom_attachment = IrAttachment.search([("url", "=", custom_url)]) + datas = base64.b64encode((content or "\n").encode("utf-8")) if custom_attachment: # If it was already modified, simply override the corresponding attachment content - custom_attachment.write({"datas": base64.b64encode(content.encode("utf-8"))}) + custom_attachment.write({"datas": datas}) else: # If not, create a new attachment to copy the original LESS file content, with its modifications IrAttachment.create(dict( name = custom_url, type = "binary", mimetype = "text/less", - datas = base64.b64encode(content.encode("utf-8")), + datas = datas, datas_fname = url.split("/")[-1], url = custom_url, # Having an attachment of "binary" type with an non empty "url" field # is quite of an hack. This allows to fetch the "datas" field by adding |
