Skip to content

Commit

Permalink
linkcheck: more informative info message for ignored redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison committed Nov 19, 2024
1 parent 1029e47 commit c3c639c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sphinx/builders/linkcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,11 @@ def _check_uri(self, uri: str, hyperlink: Hyperlink) -> _URIProperties:

except requests._IgnoredRedirection as err:
# A redirection to an ignored URI was attempted; report it appropriately
return _Status.IGNORED, err.destination, err.status_code
return (
_Status.IGNORED,
f'ignored redirect: {err.destination}',
err.status_code,
)

except HTTPError as err:
error_message = str(err)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_builders/test_build_linkcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def test_ignore_redirection(app):
'filename': 'index.rst',
'lineno': 1,
'uri': f'http://{address}/',
'info': f'http://{address}/redirected',
'info': f'ignored redirect: http://{address}/redirected',
}


Expand Down

0 comments on commit c3c639c

Please sign in to comment.