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

Should linkcheck allow redirected URLs or raise these as warnings? #330

Open
lochhh opened this issue Oct 22, 2024 · 1 comment
Open

Should linkcheck allow redirected URLs or raise these as warnings? #330

lochhh opened this issue Oct 22, 2024 · 1 comment
Labels
question Further information is requested

Comments

@lochhh
Copy link
Collaborator

lochhh commented Oct 22, 2024

We currently only have a single redirected URL:

('index', 3295):redirect https://zenodo.org/doi/10.5281/zenodo.12755724 - with Found to https://zenodo.org/records/13711296
Build succeeded (without warnings)

TLDR: Do we want to detect unexpected redirects with linkcheck?

I expected sphinx-build to fail from the above redirect, since we are using the fail-on-warnings mode.
Looking in linkcheck.py, warnings are emitted for unexpected redirects ONLY IF linkcheck_allowed_redirects is configured.

In other words, we get the above outputs because linkcheck_allowed_redirects is not configured.

  • If linkcheck_allowed_redirects is configured and the redirected URL is in the config, e.g.:

    linkcheck_allowed_redirects = {
        r"https://zenodo\.org/doi/.*": r"https://zenodo\.org/records/.*",
    }

    ( index: line 3295) ok https://zenodo.org/doi/10.5281/zenodo.12755724
    Build succeeded

  • If linkcheck_allowed_redirects is configured but the redirected URL is not in the config, e.g.:

    linkcheck_allowed_redirects = {
        r"https://somepage/.*": r"https://redirectedpage/.*",
    }

    (index: line 3295): WARNING: redirect https://zenodo.org/doi/10.5281/zenodo.12755724 - with Found to https://zenodo.org/records/13711296
    build finished with problems, 1 warning (with warnings treated as errors).

I also just wanted to document this somewhere to avoid going down the same 🐰 🕳️ again 😅

@lochhh lochhh added the question Further information is requested label Oct 22, 2024
@niksirbi
Copy link
Member

Thanks for digging this up @lochhh!

I'm unsure tbh. having to keep a "whitelist" of redirects is one more maintenance burden for us, but on the other hand, I'd like to know if a previously valid link now points to something irrelevant/scammy.

Given that there is only one redirect, perhaps slight preference towards having an explicit whiteliest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: 🤔 Triage
Development

No branches or pull requests

2 participants