Skip to content

Relative links are not being checked #1654

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

Open
mikeford opened this issue Mar 15, 2025 · 4 comments
Open

Relative links are not being checked #1654

mikeford opened this issue Mar 15, 2025 · 4 comments
Labels
bug Something isn't working regression triage

Comments

@mikeford
Copy link

Problem

Lychee does not check relative links when run against a live URL (a.k.a. a non-local check)

Steps to reproduce

lychee https://foo.com/bar.htm --dump --verbose

where bar.htm contains the following HTML code:

<a href="my-relative-page.htm" target="_blank">This is a link to a relative page that lives in the same directory as bar.htm</a>

Expected results

Lychee checks and reports on the status of my-relative-page.htm

Actual results

Lychee does not even mention my-relative-page.htm in the report

Any help with this would be much appreciated. I've tried using --base which doesn't seem to help. I noticed the decision matrix in this project's Readme mentions the skipping of relative links as a feature, but hopefully there's a way to enable this. For context I'm working on a documentation site that makes heavy use of relative links (e.g. topic.htm or ../../relative/path/to/topic.htm)

@mre
Copy link
Member

mre commented Mar 15, 2025

Yes, sorry about that. Can you try the dev PR at #1624? Would be helpful if you run into any issues with it. Definitely need some more testers. 😅 You would have to build lychee from the sources, though.

@mikeford
Copy link
Author

@mre Thanks for the fast response! I'm glad to see there's already a fix in the works.

I'm not familiar with Rust but I did the following:

  • Cloned the relative-link-fixes branch
  • cargo install lychee from within the lychee directory
  • cd ~/.cargo/bin
  • ./lychee https://foo.com/bar.htm --dump --verbose

Unfortunately I still don't see the relative links in the output report. If you want I can provide the link to the exact public-facing documentation page I'm using to test. However, I'd rather do that by email for privacy reasons.

@mre
Copy link
Member

mre commented Mar 17, 2025

Yes, the steps look correct. Sorry to hear that it still doesn't work. 😕

Can you try to explicitly set the base URL?

lychee --base https://foo.com/ https://foo.com/bar.htm --dump --verbose

Edit: You mentioned that before, but just to double-check that it still doesn't work on the relative-link-fixes branch.

@mikeford
Copy link
Author

mikeford commented Mar 17, 2025

@mre I confirmed it still doesn't work with --base on the relative-link-fixes branch.

As I mentioned, I'm happy to send you the exact invocation I'm running via email so you can reproduce the issue. Just don't want to expose the User-Agent field / URL in a public venue.

Edit: I've sent you an email with more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression triage
Projects
None yet
Development

No branches or pull requests

3 participants