Test if anchor has href attribute before converting it

It is valid HTML to have anchor without href attribute.

Closes #12134
(grafted from f3a2d9b2258d6004fffc5431136bd36b010b7f9b)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier
2023-03-10 12:53:00 +01:00
parent 4d10f95ebc
commit d1c40ad882
2 changed files with 2 additions and 2 deletions
@@ -567,7 +567,7 @@ class Activity(ModelSQL, ModelView):
for kind, data, pos in stream:
if kind is START:
tag, attrs = data
if tag == 'a':
if tag == 'a' and attrs.get('href'):
href = attrs.get('href')
attrs -= 'href'
if href.startswith('unsubscribe'):
+1 -1
View File
@@ -425,7 +425,7 @@ class Message(Workflow, ModelSQL, ModelView):
for kind, data, pos in stream:
if kind is START:
tag, attrs = data
if tag == 'a':
if tag == 'a' and attrs.get('href'):
href = attrs.get('href')
attrs -= 'href'
href = short(href, str(message))