Skip to content

Commit a6d7ae1

Browse files
linkcheck: documentation and validation suggestions for linkcheck_allowed_redirects (#13458)
Co-authored-by: Adam Turner <[email protected]>
1 parent 3c4b4e3 commit a6d7ae1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

doc/usage/configuration.rst

-1
Original file line numberDiff line numberDiff line change
@@ -3642,7 +3642,6 @@ and which failures and redirects it ignores.
36423642

36433643
.. confval:: linkcheck_allowed_redirects
36443644
:type: :code-py:`dict[str, str]`
3645-
:default: :code-py:`{}`
36463645

36473646
A dictionary that maps a pattern of the source URI
36483647
to a pattern of the canonical URI.

sphinx/builders/linkcheck.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,11 @@ def compile_linkcheck_allowed_redirects(app: Sphinx, config: Config) -> None:
754754
config.linkcheck_allowed_redirects = None
755755
return
756756
if not isinstance(config.linkcheck_allowed_redirects, dict):
757-
raise ConfigError
757+
msg = __(
758+
f'Invalid value `{config.linkcheck_allowed_redirects!r}` in '
759+
'linkcheck_allowed_redirects. Expected a dictionary.'
760+
)
761+
raise ConfigError(msg)
758762
allowed_redirects = {}
759763
for url, pattern in config.linkcheck_allowed_redirects.items():
760764
try:

0 commit comments

Comments
 (0)