readthedocs / addons

JavaScript client to integrate with Read the Docs nicely
https://readthedocs-addons.readthedocs.io/
MIT License
22 stars 6 forks source link

`searchtools.js` override responds as text/plain content type #410

Closed agjohnson closed 1 month ago

agjohnson commented 1 month ago

Noticed on user docs, Sphinx search pages throw a number of errors about an uninitialized Search instance. This instance normally comes from the searchtools.js injection. I notice in Firefox that the content type is text/plain and Firefox rejects this as a corrupted file:

% curl -sI https://docs.vyperlang.org/en/v0.3.9/_static/searchtools.js | grep '^content-type'
content-type: text/plain;charset=UTF-8

This is likely due to the Addons injection here [^1]:

https://github.com/readthedocs/common/blob/b8051be8f8221f5fe448dc81e1f2c7668090a732/dockerfiles/force-readthedocs-addons.js#L232-L238

That shouldn't return a fresh Response instance without all of the existing headers from the previous response.

[^1]: I'm opening this issue here instead of common as that repo is not discoverable.

Front logo Front conversations