From f2ac3cc3aa651115bfd9b987a97708e2f76a6519 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Mon, 26 Mar 2018 21:07:13 -0700 Subject: [PATCH] Another CORS hotfix for the sustainability API --- readthedocs/core/signals.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readthedocs/core/signals.py b/readthedocs/core/signals.py index a3e229656f3..aa2a30936c0 100644 --- a/readthedocs/core/signals.py +++ b/readthedocs/core/signals.py @@ -20,6 +20,7 @@ '/api/v2/footer_html', '/api/v2/search', '/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): 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: project_slug = request.GET.get('project', None) try: