Merge pull request #3862 from davidfischer/sustain-cors-hotfix

Another CORS hotfix for the sustainability API
humitos/resolver/username-regex
Eric Holscher 2018-03-27 11:40:21 +07:00 committed by GitHub
commit adb5392c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,7 @@ WHITELIST_URLS = [
'/api/v2/footer_html', '/api/v2/footer_html',
'/api/v2/search', '/api/v2/search',
'/api/v2/docsearch', '/api/v2/docsearch',
'/api/v2/sustainability',
] ]
@ -46,6 +47,10 @@ def decide_if_cors(sender, request, **kwargs): # pylint: disable=unused-argumen
if request.path_info.startswith(url): if request.path_info.startswith(url):
valid_url = True valid_url = True
# 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)
try: try: