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

URLs without prefix of "./" get a 404 #374

Open
jodymgustafson opened this issue Jan 19, 2022 · 5 comments
Open

URLs without prefix of "./" get a 404 #374

jodymgustafson opened this issue Jan 19, 2022 · 5 comments

Comments

@jodymgustafson
Copy link

jodymgustafson commented Jan 19, 2022

Relative URLs without prefix of "./" get a 404. For example: <a href="harmonograph"> in http://localhost:8080/apps/web reports this error:

http://localhost:8080/apps/web
[404] http://localhost:8080/apps/harmonograph

The link works in the browser resolving to the current folder, but in linkinator it seems to be resolving to the parent folder. It should resolve to this folder instead: http://localhost:8080/apps/web/harmonograph

@jodymgustafson
Copy link
Author

Now I don't think it even works when it does start with "./". I changed the link to <a href="./harmonograph"> and still it tries to resolve to parent.

http://localhost:8080/apps/web
[404] http://localhost:8080/apps/harmonograph

Maybe the real problem is that my links don't explicitly reference an index.html file?

@peastman
Copy link

I was about to report what I think is the same problem. It was just introduced in one of the last few releases. With 3.0.3 it reports every relative link to another file in the same directory as being broken:

    [404] search.html
    [404] 01_introduction.html
    [404] _static/custom.css
    [404] 02_core_library.html

etc. But with 3.0.0 it reports all those links as being found.

@JustinBeckwith
Copy link
Owner

Greetings! Can you share a few things with me to make debugging easier?

  • The exact command you're running with linkinator
  • The directory structure you have locally

I'm trying to reproduce this, but having a little trouble figuring out exactly what's happening :)

@peastman
Copy link

Thanks! We're building HTML documentation with Sphinx, and using linkinator on Github Actions to check for broken links in each PR. Here is the section of the script that runs it.

for d in api-c++ api-python developerguide userguide; do
  echo "::group:: Check ${d}"
  npx linkinator ./${d}/ --recurse --timeout=20000 --skip "$SKIP_REGEX" --server-root ./build/api-docs --verbosity error
  ((exitcode+=$?))
  echo "::endgroup::"
done

As you can guess, the api-docs directory contains four directories called api-c++, api-python, developerguide, and userguide. Each has a similar structure since they're all built with Sphinx. Here is an example:

$ ls -R developerguide/
doctrees	html

developerguide//doctrees:
01_introduction.doctree		04_reference_platform.doctree	07_cuda_platform.doctree	index.doctree
02_core_library.doctree		05_cpu_platform.doctree		08_common_compute.doctree	license.doctree
03_writing_plugins.doctree	06_opencl_platform.doctree	environment.pickle

developerguide//html:
01_introduction.html		05_cpu_platform.html		_images				license.html
02_core_library.html		06_opencl_platform.html		_sources			objects.inv
03_writing_plugins.html		07_cuda_platform.html		_static				search.html
04_reference_platform.html	08_common_compute.html		index.html			searchindex.js

developerguide//html/_images:
ArchitectureLayers.jpg		SystemContextRelationships.jpg

developerguide//html/_sources:
01_introduction.rst.txt		04_reference_platform.rst.txt	07_cuda_platform.rst.txt	license.rst.txt
02_core_library.rst.txt		05_cpu_platform.rst.txt		08_common_compute.rst.txt
03_writing_plugins.rst.txt	06_opencl_platform.rst.txt	index.rst.txt

developerguide//html/_static:
alabaster.css			documentation_options.js	language_data.js		pygments.css
basic.css			file.png			logo.png			searchtools.js
custom.css			jquery-3.5.1.js			minus.png			underscore-1.13.1.js
doctools.js			jquery.js			plus.png			underscore.js

@jodymgustafson
Copy link
Author

If you run it against my website you will see a lot of invalid 404s reported.

npx linkinator https://worldtreesoftware.com --recurse

One example, it's looking for "intro" in the parent instead of relative to the current page.
https://worldtreesoftware.com/apps/web/harmonograph
[404] https://worldtreesoftware.com/apps/web/intro

It should be looking here: https://worldtreesoftware.com/apps/web/harmonograph/intro

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

No branches or pull requests

3 participants