Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
f3a2d9b2 by Cédric Krier at 2023-03-10T12:53:00+01:00
Test if anchor has href attribute before converting it

It is valid HTML to have anchor without href attribute.

Closes #12134
- - - - -


2 changed files:

- modules/marketing_automation/marketing_automation.py
- modules/marketing_email/marketing.py


Changes:

=====================================
modules/marketing_automation/marketing_automation.py
=====================================
@@ -572,7 +572,7 @@
             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'):


=====================================
modules/marketing_email/marketing.py
=====================================
@@ -451,7 +451,7 @@
                 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))



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/f3a2d9b2258d6004fffc5431136bd36b010b7f9b

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/f3a2d9b2258d6004fffc5431136bd36b010b7f9b
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to