[FIX] mail: avoid generation link preview on internal link
If website is installed, the login page of Odoo has opengraph meta that will be used to create link preview on mention and channel link. This PR add a xpath condition to always ignore mention and channel link in the message body. Part of task-3000274 closes odoo/odoo#101678 X-original-commit: eb032a5c36af6402b79ae768ce29b3d84eacf3b7 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com> Signed-off-by: Debondt Didier (did) <did@odoo.com>
This commit is contained in:
@@ -29,7 +29,7 @@ class LinkPreview(models.Model):
|
||||
if not message.body:
|
||||
return
|
||||
tree = html.fromstring(message.body)
|
||||
urls = tree.xpath('//a/@href')
|
||||
urls = tree.xpath('//a[not(@data-oe-model)]/@href')
|
||||
link_previews = self.env['mail.link.preview']
|
||||
requests_session = requests.Session()
|
||||
# Some websites are blocking non browser user agent.
|
||||
|
||||
Reference in New Issue
Block a user