diff options
| author | Didier (did) <did@odoo.com> | 2020-10-26 09:31:01 +0000 |
|---|---|---|
| committer | Didier (did) <did@odoo.com> | 2020-11-02 12:35:19 +0000 |
| commit | fecd2b28309b0fa4e5ecb8c7d26f6a335036e740 (patch) | |
| tree | 21beec022fdcd78f78eb5418adc2104e6c8a88fb /addons/mail/static/src/models/composer/composer.js | |
| parent | bbfaf1f805c90f1c9bf87e6a06481ecc88bc24b9 (diff) | |
[FIX] mail: escape the mentionned channels before matching them
Escaping the match name is escaping an already escaped string from
`postMessage`. How ever we need to escape the string from
`this.mentionedPartners` and `this.mentionedChannels` since they are matched
with an escaped string.
This fix the bug when mentionning a channel with `&` in it's name.
task-2366680
PR https://github.com/odoo/odoo/pull/60593
Diffstat (limited to 'addons/mail/static/src/models/composer/composer.js')
| -rw-r--r-- | addons/mail/static/src/models/composer/composer.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js index cfc298d2b13..a712f509630 100644 --- a/addons/mail/static/src/models/composer/composer.js +++ b/addons/mail/static/src/models/composer/composer.js @@ -587,7 +587,7 @@ function factory(dependencies) { let startIndex = 0; for (const match of inputMentions) { const suggestionDelimiter = match[0]; - const matchName = owl.utils.escape(match.substring(1).replace(new RegExp('\u00a0', 'g'), ' ')); + const matchNameEscaped = match.substring(1).replace(new RegExp('\u00a0', 'g'), ' '); const endIndex = body.indexOf(match, startIndex) + match.length; let field = "mentionedPartners"; let model = "res.partner"; @@ -598,9 +598,9 @@ function factory(dependencies) { cssClass = "o_channel_redirect"; } const mention = this[field].find(mention => - mention.name === matchName + owl.utils.escape(mention.name) === matchNameEscaped ); - let mentionLink = suggestionDelimiter + matchName; + let mentionLink = suggestionDelimiter + matchNameEscaped; if (mention) { const baseHREF = this.env.session.url('/web'); const href = `href='${baseHREF}#model=${model}&id=${mention.id}'`; @@ -608,7 +608,7 @@ function factory(dependencies) { const dataOeId = `data-oe-id='${mention.id}'`; const dataOeModel = `data-oe-model='${model}'`; const target = `target='_blank'`; - mentionLink = `<a ${href} ${attClass} ${dataOeId} ${dataOeModel} ${target} >${suggestionDelimiter}${matchName}</a>`; + mentionLink = `<a ${href} ${attClass} ${dataOeId} ${dataOeModel} ${target} >${suggestionDelimiter}${matchNameEscaped}</a>`; } substrings.push(body.substring(startIndex, body.indexOf(match, startIndex))); substrings.push(mentionLink); |
