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

linkcheck: take source directory into account for local files #8245

Merged
merged 2 commits into from Oct 4, 2020

Conversation

mgeier
Copy link
Contributor

@mgeier mgeier commented Sep 27, 2020

In #7985, the linkcheck builder has been extended to also check local links.

However, the local file URIs are checked relative to the global source directory.
If a relative path is used in a source file in a sub-directory, the file is not found and a linkcheck error is reported.

This PR uses the actual source directory of the current source file.

Feature or Bugfix

  • Bugfix

Relates

@@ -256,7 +256,8 @@ def check() -> Tuple[str, str, int]:
uri, docname, lineno = self.wqueue.get()
if uri is None:
break
status, info, code = check()
srcdir = path.dirname(self.env.doc2path(docname))
status, info, code = check(srcdir)
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to pass docname instead of srcdir.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: 6b3d445

@tk0miya tk0miya merged commit 837a4d1 into sphinx-doc:3.x Oct 4, 2020
@tk0miya
Copy link
Member

tk0miya commented Oct 4, 2020

Thank you for update. Merged!

tk0miya added a commit that referenced this pull request Oct 4, 2020
@tk0miya tk0miya added this to the 3.3.0 milestone Oct 4, 2020
@mgeier mgeier deleted the linkcheck-sourcedir branch October 4, 2020 08:20
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants