Skip to content
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

[FIX] survey: Unescape characters in mail subject #71229

Closed

Conversation

adwid
Copy link
Contributor

@adwid adwid commented May 25, 2021

To reproduce the error:
Create a survey (title must contain ") and send it

Error:
The mail subject is incorrect: the character " is replaced with "

OPW-2536206

@adwid
Copy link
Contributor Author

adwid commented May 25, 2021

@nle-odoo

@robodoo
Copy link
Contributor

robodoo commented May 25, 2021

Pull request status dashboard

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label May 25, 2021
@adwid adwid force-pushed the 13.0-OPW-2536206-survey_escape_char-awt branch from f6d57b4 to 9a99d42 Compare May 25, 2021 15:14
@adwid adwid requested a review from a team as a code owner May 25, 2021 15:14
@tde-banana-odoo
Copy link
Contributor

That's really strange as it would be the case with all char-based jinja fields. Safe is used to enable html, why should it be required here ?

@adwid
Copy link
Contributor Author

adwid commented May 26, 2021

@tde-banana-odoo I think that most of the time, jinja fields are rendered inside html body, which is not the case for the mail subject
Here, safe prevents automatic escaping

@nle-odoo
Copy link
Contributor

nle-odoo commented May 26, 2021

in most case we don't use jinja autoescape on mail subject after this change: http://github.com/odoo/odoo/commit/6dde919bb9850912f618b561cd2141bffe41340c

so here we should have safe=True in context of:

subject = self.env['mail.template']._render_template(self.subject, 'survey.user_input', answer.id, post_process=True)

edit: checking _render_template.*subject there is 5 more locations where we do this without safe in context

To reproduce the error:
Create a survey (title must contain ") and send it

Error:
The mail subject is incorrect: the character " is replaced with "

OPW-2536206
@adwid adwid force-pushed the 13.0-OPW-2536206-survey_escape_char-awt branch from 9a99d42 to 40b6074 Compare May 26, 2021 09:57
@tde-banana-odoo
Copy link
Contributor

I would say don't use context and add pipes, but this would break translations, so I suppose go for context indeed.

Copy link
Contributor

@nle-odoo nle-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robodoo r+

robodoo pushed a commit that referenced this pull request May 27, 2021
To reproduce the error:
Create a survey (title must contain ") and send it

Error:
The mail subject is incorrect: the character " is replaced with "

OPW-2536206

closes #71229

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
@robodoo robodoo closed this May 27, 2021
@robodoo robodoo temporarily deployed to merge May 27, 2021 17:28 Inactive
@adwid adwid deleted the 13.0-OPW-2536206-survey_escape_char-awt branch May 28, 2021 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants