Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
amureki committed Aug 19, 2024
1 parent 5293785 commit 167512d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions emark/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def test_inject_utm_params(self):
in email_message.body
)
assert (
"localhost:8000 <localhost:8000?utm_source=website&utm_medium=email&utm_campaign=MARKDOWN_EMAIL_TEST_WITH_SUBJECT>"
"localhost:8000 <http://localhost:8000?utm_source=website&utm_medium=email&utm_campaign=MARKDOWN_EMAIL_TEST_WITH_SUBJECT>"
in email_message.body
)
assert "555-2368 <tel:5552368>" in email_message.body
Expand Down
2 changes: 1 addition & 1 deletion tests/testapp/templates/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<a href="https://www.example.com/html">An HTML Link</a>

0 comments on commit 167512d

Please sign in to comment.