[FIX] re.search will return None when nothing found. So we have to check for this

This commit is contained in:
Wolfgang Pichler 2020-10-23 14:16:12 +02:00 committed by Jasmin Solanki
parent 399e4fad0c
commit 26c6cd33af
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@
{
"name": "Email tracking",
"summary": "Email tracking system for all mails sent",
"version": "13.0.1.0.4",
"version": "13.0.1.0.5",
"category": "Social Network",
"website": "http://github.com/OCA/social",
"author": ("Tecnativa, " "Odoo Community Association (OCA)"),

View File

@ -23,7 +23,7 @@ class IrMailServer(models.Model):
body = body or ""
# https://regex101.com/r/lW4cB1/2
match = re.search(r'<img[^>]*data-odoo-tracking-email=["\']([0-9]*)["\']', body)
return int(match.group(1)) if match.group(1) else False
return int(match.group(1)) if match and match.group(1) else False
def build_email(
self,