Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redirection for pages missing in other docs versions #1395

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

drammock
Copy link
Collaborator

@drammock drammock commented Jul 26, 2023

related #844
related #1343

I think this should fix our redirection problems. The error was that we assumed that a 404 response would be an error, but as far as Javascript is concerned a 404 response is still a real response! Now we check for response.ok (meaning a response in the 200-299 range) and triage the URL accordingly. The try/catch is left in place as a fallback in case something actually did go wrong with the request/response (i.e., on local or PR builds when the request is blocked due to CORS restrictions).

cc @lagru would appreciate if you could test this branch and report back

Copy link
Collaborator

@12rambau 12rambau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CORS issue is working, I'll merge it to check the build in release. Note that I changed the PR comment to avoid closing the issues if it doesn't work.

@12rambau 12rambau merged commit c610f9a into pydata:main Jul 27, 2023
@12rambau
Copy link
Collaborator

tested on this page: https://pydata-sphinx-theme.readthedocs.io/en/latest/examples/gallery.html
It does not exist in V0.9 and the redirection worked as expected. Congrats, I'll close the associated issues.

@lagru
Copy link

lagru commented Jul 28, 2023

At least locally this seems to resolve the issue! When I select a version that doesn't have an equivalent page it resolves to the root of that target version. I'll keep an eye on this and report back should the issue resurface for us.

@drammock, thanks for tackling this! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants