diff --git a/emark/message.py b/emark/message.py index 868f612..b08f7a6 100644 --- a/emark/message.py +++ b/emark/message.py @@ -131,10 +131,10 @@ def inject_utm_params(self, md, **utm): for url in INLINE_LINK_RE.findall(md): try: url_parts = parse.urlparse(url) - if url_parts.scheme and url_parts.scheme not in [ + if url_parts.scheme not in [ "http", "https", - "localhost", + "", ]: continue except ValueError: @@ -143,10 +143,10 @@ def inject_utm_params(self, md, **utm): for url in INLINE_HTML_LINK_RE.findall(md): try: url_parts = parse.urlparse(url) - if url_parts.scheme and url_parts.scheme not in [ + if url_parts.scheme not in [ "http", "https", - "localhost", + "", ]: continue except ValueError: diff --git a/tests/test_message.py b/tests/test_message.py index 70eae0d..6853250 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -281,7 +281,7 @@ def test_inject_utm_params(self): in email_message.body ) assert ( - "localhost:8000 " + "localhost:8000 " in email_message.body ) assert "555-2368 " in email_message.body diff --git a/tests/testapp/templates/template.md b/tests/testapp/templates/template.md index ffc4c61..c597367 100644 --- a/tests/testapp/templates/template.md +++ b/tests/testapp/templates/template.md @@ -13,7 +13,7 @@ Vanilla lollipop biscuit cake marzipan jelly. [A link with parameter](https://www.example.com/?foo=bar) [A link without a scheme](www.example.com) [A link without www](example.com) -[localhost:8000](localhost:8000) +[localhost:8000](http://localhost:8000) [555-2368](tel:5552368) An HTML Link