diff options
Diffstat (limited to 'sphinx/builders/linkcheck.py')
-rw-r--r-- | sphinx/builders/linkcheck.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index bdce45c68..8b750df2d 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -382,11 +382,11 @@ class HyperlinkAvailabilityCheckWorker(Thread): return 'redirected', new_url, 0 def allowed_redirect(url: str, new_url: str) -> bool: - for from_url, to_url in self.config.linkcheck_allowed_redirects.items(): - if from_url.match(url) and to_url.match(new_url): - return True - - return False + return any( + from_url.match(url) and to_url.match(new_url) + for from_url, to_url + in self.config.linkcheck_allowed_redirects.items() + ) def check(docname: str) -> tuple[str, str, int]: # check for various conditions without bothering the network |