Skip to content

Commit

Permalink
don't print file extension twice in linkcheck warnings
Browse files Browse the repository at this point in the history
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
  • Loading branch information
hoefling committed Sep 27, 2021
1 parent f34eb49 commit 36a6fca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sphinx/builders/linkcheck.py
Expand Up @@ -255,7 +255,7 @@ def process_result(self, result: CheckResult) -> None:
elif result.status == 'broken':
if self.app.quiet or self.app.warningiserror:
logger.warning(__('broken link: %s (%s)'), result.uri, result.message,
location=(filename, result.lineno))
location=(result.docname, result.lineno))
else:
logger.info(red('broken ') + result.uri + red(' - ' + result.message))
self.write_entry('broken', result.docname, filename, result.lineno,
Expand All @@ -274,7 +274,7 @@ def process_result(self, result: CheckResult) -> None:
linkstat['text'] = text
if self.config.linkcheck_allowed_redirects:
logger.warning('redirect ' + result.uri + ' - ' + text + ' to ' +
result.message, location=(filename, result.lineno))
result.message, location=(result.docname, result.lineno))
else:
logger.info(color('redirect ') + result.uri +
color(' - ' + text + ' to ' + result.message))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build_linkcheck.py
Expand Up @@ -305,7 +305,7 @@ def test_linkcheck_allowed_redirects(app, warning):
assert result["http://localhost:7777/path1"] == "working"
assert result["http://localhost:7777/path2"] == "redirected"

assert ("index.rst.rst:1: WARNING: redirect http://localhost:7777/path2 - with Found to "
assert ("index.rst:1: WARNING: redirect http://localhost:7777/path2 - with Found to "
"http://localhost:7777/?redirected=1\n" in strip_escseq(warning.getvalue()))
assert len(warning.getvalue().splitlines()) == 1

Expand Down

0 comments on commit 36a6fca

Please sign in to comment.