Minimum refactor to decide_if_cors
parent
2f5ae97d54
commit
bd7b9fee7a
|
@ -42,14 +42,16 @@ def decide_if_cors(sender, request, **kwargs): # pylint: disable=unused-argumen
|
||||||
if 'HTTP_ORIGIN' not in request.META:
|
if 'HTTP_ORIGIN' not in request.META:
|
||||||
return False
|
return False
|
||||||
host = urlparse(request.META['HTTP_ORIGIN']).netloc.split(':')[0]
|
host = urlparse(request.META['HTTP_ORIGIN']).netloc.split(':')[0]
|
||||||
|
|
||||||
|
# Don't do domain checking for this API for now
|
||||||
|
if request.path_info.startswith('/api/v2/sustainability'):
|
||||||
|
return True
|
||||||
|
|
||||||
valid_url = False
|
valid_url = False
|
||||||
for url in WHITELIST_URLS:
|
for url in WHITELIST_URLS:
|
||||||
if request.path_info.startswith(url):
|
if request.path_info.startswith(url):
|
||||||
valid_url = True
|
valid_url = True
|
||||||
|
break
|
||||||
# Don't do domain checking for this API for now
|
|
||||||
if request.path_info.startswith('/api/v2/sustainability'):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if valid_url:
|
if valid_url:
|
||||||
project_slug = request.GET.get('project', None)
|
project_slug = request.GET.get('project', None)
|
||||||
|
|
Loading…
Reference in New Issue