Skip to content

Commit e50d34b

Browse files
committed
Return None when sanitizing shop domain if None passed in
1 parent f9c9e19 commit e50d34b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

shopify/utils/shop_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
def sanitize_shop_domain(shop_domain, myshopify_domain="myshopify.com"):
13-
name = str(shop_domain).lower().strip()
13+
name = str(shop_domain or "").lower().strip()
1414
if myshopify_domain not in name and "." not in name:
1515
name += ".{domain}".format(domain=myshopify_domain)
1616
name = re.sub(r"https?://", "", name)

test/utils/shop_url_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ def test_returns_hostname_for_custom_shop_domains(self):
4242
]
4343

4444
self.assertTrue(all(shop == "my-shop.myshopify.io" for shop in sanitized_shops))
45+
46+
def test_returns_none_for_none_type(self):
47+
self.assertIsNone(shop_url.sanitize_shop_domain(None))

0 commit comments

Comments
 (0)