-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
root-relative links ignored with default config #1265
Comments
FYI: moved the issue to the lychee main repo, because it's a better fit there. |
Thanks for the thorough analysis. Yes, However, setting If we change that behavior, we have to track (or infer) whether the source is a directory path or a URL. Sounds straightforward, but there are edge-cases like I do think that this can be resolved, it just requires more research and thorough testing to avoid any future surprises. I would love to get some help on this by mapping out all cases and maybe writing some tests. |
Thanks for triaging this mre. Would it make sense to add some small description to the README of the lychee-action repo so that others are aware they should add |
Yes, absolutely. Pull requests to lychee-action (and possibly lychee) to clarify the behavior would be very welcome. I'm too involved in the tool creation to make this an easy task for me, as it's kinda obvious by now, but of course that's just Stockholm syndrome. 😆 |
To add my two cents here, although I think a README change is probably sufficient, it seems like there could be some type of enhancement that would at least let users know that root-level files were discovered and skipped. Even if that were only shown in a debug or verbose mode, that'd be fine and probably enough to point users in the right direction. My expectation as a user of lychee is that there's some setting which will tell me absolutely every link lychee "saw" and what its disposition is. Even if the |
Fair. As a first step we could print the ignored potential links in verbose mode. |
Root-relative links in markdown like
[link](/some/dir/file.md)
don't get tested as expected, with the default (alternative) config (as opposed to[link](some/dir/file.md
). By root-relative I mean those that begin with a/
indicating the root of the domain. It appears to ignore those links altogether neither flagging them as good or bad.I have a page like this:
I expect 3 failures on this page, but only get:
As you can see link-3 starts with a
/
.reproduction repo
I setup a separate repo to test this. It has 4 bad links.
I'm also testing it in two ways. (1) the suggested alternate config from lychee-action, (2) with the addition of a
--base .
param.I've found that setting
--base .
solves the problem. It finds the rest of the files which the default ignores. I think this should probably be the default / advertised config.I have 3 test setups in my test repo.
--base .
added and original args copied ✅test 1: PRs as markdown with the default suggested config
Using config:
Detects only some bad links
https://github.com/tgaff/some-gh-pages-site/actions/runs/6453247265/job/17516481918?pr=6
test 2: slightly altered config to specify
--base .
All 4 bad links detected including
bad-link-3
:https://github.com/tgaff/some-gh-pages-site/actions/runs/6453247263/job/17516481903?pr=6
Additional commentary
Yes I could adjust every link to not begin with slash and it would have zero ill-effects. However it seems odd that its necessary - especially given that the links are correct when clicking in the markdown on GitHub and also correct as part of the GitHub pages site. There's no guarantee that someone won't include such a link in their branch in the future - and it would silently slip through.
Would a PR adding
--base .
as part of the default be accepted?The text was updated successfully, but these errors were encountered: