Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove port from allowed storefront validation
fowczarek14b61a5896bc
diff --git a/saleor/core/utils/url.py b/saleor/core/utils/url.pyindex 415373e8ea..93f1c5df74 100644--- a/saleor/core/utils/url.py+++ b/saleor/core/utils/url.py@@ -2,7 +2,7 @@ from urllib.parse import urlparsefrom django.conf import settingsfrom django.core.exceptions import ValidationError-from django.http.request import validate_host+from django.http.request import split_domain_port, validate_hostdef validate_storefront_url(url):@@ -13,12 +13,8 @@ def validate_storefront_url(url):"""try:parsed_url = urlparse(url)+ domain, _ = split_domain_port(parsed_url.netloc)except ValueError as error:raise ValidationError({"redirectUrl": str(error)})- if not validate_host(parsed_url.netloc, settings.ALLOWED_STOREFRONT_HOSTS):- raise ValidationError(- {- "redirectUrl": "%s this is not valid storefront address."- % parsed_url.netloc- }- )+ if not validate_host(domain, settings.ALLOWED_STOREFRONT_HOSTS):+ raise ValidationError({"redirectUrl": f"{domain} this is not allowed address."})