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:
@@ -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'):
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user