Merge pull request #7073 from tk0miya/7055_redirect_should_be_warning

Fix #7055: linkcheck: redirect is treated as an error
This commit is contained in:
Takeshi KOMIYA 2020-01-31 01:04:37 +09:00 committed by GitHub
commit 13be2710ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -63,6 +63,7 @@ Bugs fixed
* #7023: autodoc: nested partial functions are not listed
* #7023: autodoc: partial functions imported from other modules are listed as
module members without :impoprted-members: option
* #7055: linkcheck: redirect is treated as an error
Testing
--------

View File

@ -26,7 +26,7 @@ from sphinx.builders import Builder
from sphinx.locale import __
from sphinx.util import encode_uri, requests, logging
from sphinx.util.console import ( # type: ignore
purple, red, darkgreen, darkgray, darkred, turquoise
purple, red, darkgreen, darkgray, turquoise
)
from sphinx.util.nodes import get_node_line
from sphinx.util.requests import is_ssl_error
@ -251,11 +251,11 @@ class CheckExternalLinksBuilder(Builder):
elif status == 'redirected':
try:
text, color = {
301: ('permanently', darkred),
301: ('permanently', purple),
302: ('with Found', purple),
303: ('with See Other', purple),
307: ('temporarily', turquoise),
308: ('permanently', darkred),
308: ('permanently', purple),
}[code]
except KeyError:
text, color = ('with unknown code', purple)