Skip to content

Commit

Permalink
Add "all caps" case
Browse files Browse the repository at this point in the history
  • Loading branch information
amureki committed Aug 19, 2024
1 parent 167512d commit 111b561
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions emark/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ 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 not in [
if url_parts.scheme.lower() not in [
"http",
"https",
"",
Expand All @@ -143,7 +143,7 @@ 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 not in [
if url_parts.scheme.lower() not in [
"http",
"https",
"",
Expand Down
4 changes: 4 additions & 0 deletions tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ def test_inject_utm_params(self):
"A link without www <example.com?utm_source=website&utm_medium=email&utm_campaign=MARKDOWN_EMAIL_TEST_WITH_SUBJECT>"
in email_message.body
)
assert (
"ALL CAPS LINK <http://WWW.EXAMPLE.COM?utm_source=website&utm_medium=email&utm_campaign=MARKDOWN_EMAIL_TEST_WITH_SUBJECT>"
in email_message.body
)
assert (
"localhost:8000 <http://localhost:8000?utm_source=website&utm_medium=email&utm_campaign=MARKDOWN_EMAIL_TEST_WITH_SUBJECT>"
in email_message.body
Expand Down
1 change: 1 addition & 0 deletions tests/testapp/templates/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +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)
[ALL CAPS LINK](HTTP://WWW.EXAMPLE.COM)
[localhost:8000](http://localhost:8000)
[555-2368](tel:5552368)

Expand Down

0 comments on commit 111b561

Please sign in to comment.