mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9678 from hoefling/fix-linkcheck-warnings
Don't print file extension twice in linkcheck warnings
This commit is contained in:
commit
ea8b3d3d5f
@ -255,7 +255,7 @@ class CheckExternalLinksBuilder(DummyBuilder):
|
|||||||
elif result.status == 'broken':
|
elif result.status == 'broken':
|
||||||
if self.app.quiet or self.app.warningiserror:
|
if self.app.quiet or self.app.warningiserror:
|
||||||
logger.warning(__('broken link: %s (%s)'), result.uri, result.message,
|
logger.warning(__('broken link: %s (%s)'), result.uri, result.message,
|
||||||
location=(filename, result.lineno))
|
location=(result.docname, result.lineno))
|
||||||
else:
|
else:
|
||||||
logger.info(red('broken ') + result.uri + red(' - ' + result.message))
|
logger.info(red('broken ') + result.uri + red(' - ' + result.message))
|
||||||
self.write_entry('broken', result.docname, filename, result.lineno,
|
self.write_entry('broken', result.docname, filename, result.lineno,
|
||||||
@ -274,7 +274,7 @@ class CheckExternalLinksBuilder(DummyBuilder):
|
|||||||
linkstat['text'] = text
|
linkstat['text'] = text
|
||||||
if self.config.linkcheck_allowed_redirects:
|
if self.config.linkcheck_allowed_redirects:
|
||||||
logger.warning('redirect ' + result.uri + ' - ' + text + ' to ' +
|
logger.warning('redirect ' + result.uri + ' - ' + text + ' to ' +
|
||||||
result.message, location=(filename, result.lineno))
|
result.message, location=(result.docname, result.lineno))
|
||||||
else:
|
else:
|
||||||
logger.info(color('redirect ') + result.uri +
|
logger.info(color('redirect ') + result.uri +
|
||||||
color(' - ' + text + ' to ' + result.message))
|
color(' - ' + text + ' to ' + result.message))
|
||||||
|
@ -305,7 +305,7 @@ def test_linkcheck_allowed_redirects(app, warning):
|
|||||||
assert result["http://localhost:7777/path1"] == "working"
|
assert result["http://localhost:7777/path1"] == "working"
|
||||||
assert result["http://localhost:7777/path2"] == "redirected"
|
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()))
|
"http://localhost:7777/?redirected=1\n" in strip_escseq(warning.getvalue()))
|
||||||
assert len(warning.getvalue().splitlines()) == 1
|
assert len(warning.getvalue().splitlines()) == 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user