Skip to content

Commit 7007f98

Browse files
authored
Merge pull request #8543 from readthedocs/humitos/embed-api-cors
2 parents bbf0614 + 02ad828 commit 7007f98

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

readthedocs/core/signals.py

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'/api/v2/search',
2424
'/api/v2/docsearch',
2525
'/api/v2/embed',
26+
'/api/v3/embed',
2627
]
2728

2829
webhook_github = Signal(providing_args=['project', 'data', 'event'])
@@ -78,6 +79,12 @@ def decide_if_cors(sender, request, **kwargs): # pylint: disable=unused-argumen
7879
url = request.GET.get('url')
7980
if url:
8081
unresolved = unresolve(url)
82+
if unresolved is None:
83+
# NOTE: Embed APIv3 now supports external sites. In that case
84+
# ``unresolve()`` will return None and we want to allow it
85+
# since the target is a public project.
86+
return True
87+
8188
project = unresolved.project
8289
version_slug = unresolved.version_slug
8390
else:

0 commit comments

Comments
 (0)