-
Notifications
You must be signed in to change notification settings - Fork 23.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FW][FIX] web_editor, mass_mailing: shapes don't save #164703
[FW][FIX] web_editor, mass_mailing: shapes don't save #164703
Conversation
@ande-odoo cherrypicking of pull request #159497 failed. stdout:
stderr:
Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?). In the former case, you may want to edit this PR message as well. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
17fe187
to
99828d9
Compare
Hi @reth-odoo @Goaman I had to adapt my fix and the code around in this forward port, could you give me a review ? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems probably ok but I'll leave editor review to team editor. Just leaving a comment as runbot is red 👀
99828d9
to
8c5574d
Compare
Hi @odoo/rd-framework-editor Could you review my fw port, as I had to adapt my fix for this version ? Thanks ! |
@ande-odoo I assume it would make more sense for @bvr-odoo to have a look now since the additional changes you made seem to be the lines added in #134979. |
@ande-odoo Hello, I tested the branch and |
Current behavior: When logged as a mass mailing user, In a mailing, using the editor, when applying a shape to an image, the image disappears. Steps to reproduce: 1. Make sure Marc Demo has the role User 2. Log in as Marc Demo 3. Create a new mailing 4. Select a template 5. Insert a picture 6. Select the picture 7. Change its shape to round 8. (preview works fine) 9. Save the mailing 10. Picture disappears Cause of the issue: When applying a shape to an image, the resulting file is of mimetype 'image/svg+xml', when sending it to the server, the attachment is going to go through _check_contents https://github.com/odoo/odoo/blob/d752abb24d9b25bb6d10e411961447c8c8e28bba/odoo/addons/base/models/ir_attachment.py#L364 and if the mimetype is "xml_like", it will check for views write rights, without what the mimetype will be forced to text/plain. But in web_editor, when computing the image src https://github.com/odoo/odoo/blob/b6392e2c7dbc8e1ece326e28a9698801142714b7/addons/web_editor/models/ir_attachment.py#L34 if the mimetype is not a supported image type, src will be False. Fix: Override of _writeShape to use canvas to convert the image from svg to png. opw-3672798 X-original-commit: 1c5c9af
8c5574d
to
5a9f3fe
Compare
Hi @bvr-odoo It seems like everything is working now, can you have a look ? Thanks ! |
@ande-odoo LGTM 👍 , I tested it in Website and everything works, thanks |
@robodoo r+ |
Current behavior: When logged as a mass mailing user, In a mailing, using the editor, when applying a shape to an image, the image disappears. Steps to reproduce: 1. Make sure Marc Demo has the role User 2. Log in as Marc Demo 3. Create a new mailing 4. Select a template 5. Insert a picture 6. Select the picture 7. Change its shape to round 8. (preview works fine) 9. Save the mailing 10. Picture disappears Cause of the issue: When applying a shape to an image, the resulting file is of mimetype 'image/svg+xml', when sending it to the server, the attachment is going to go through _check_contents https://github.com/odoo/odoo/blob/d752abb24d9b25bb6d10e411961447c8c8e28bba/odoo/addons/base/models/ir_attachment.py#L364 and if the mimetype is "xml_like", it will check for views write rights, without what the mimetype will be forced to text/plain. But in web_editor, when computing the image src https://github.com/odoo/odoo/blob/b6392e2c7dbc8e1ece326e28a9698801142714b7/addons/web_editor/models/ir_attachment.py#L34 if the mimetype is not a supported image type, src will be False. Fix: Override of _writeShape to use canvas to convert the image from svg to png. opw-3672798 closes odoo#164703 X-original-commit: 1c5c9af Signed-off-by: Antoine Demany (ande) <ande@odoo.com>
Current behavior:
When logged as a mass mailing user, in a mailing, using the editor,
when applying a shape to an image, the image disappears.
Steps to reproduce:
Cause of the issue:
When applying a shape to an image, the resulting file is of mimetype 'image/svg+xml',
when sending it to the server, the attachment is going to go through _check_contents
odoo/odoo/addons/base/models/ir_attachment.py
Line 364 in d752abb
without what the mimetype will be forced to text/plain.
But in web_editor, when computing the image src
odoo/addons/web_editor/models/ir_attachment.py
Line 34 in b6392e2
Fix:
Override of _writeShape to use canvas to convert the image from svg to png.
opw-3672798
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #164013
Forward-Port-Of: #159497