Skip to content

Commit

Permalink
Handle no netloc case
Browse files Browse the repository at this point in the history
  • Loading branch information
amureki committed Jul 28, 2023
1 parent a801003 commit f6b6d71
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions emark/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def get(self, request, *args, **kwargs):
# or malformed. We use Django's URL validation to ensure that it
# is safe to redirect to.
parsed_url = urlparse(redirect_to)
if not parsed_url.netloc:
return http.HttpResponseBadRequest("Missing url or malformed parameter")

domain, _port = split_domain_port(parsed_url.netloc)
allowed_hosts = settings.ALLOWED_HOSTS
if settings.DEBUG:
Expand Down

0 comments on commit f6b6d71

Please sign in to comment.