Skip to content

Commit

Permalink
Skip remote links in LINK_CHECK_WHITELIST
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed Aug 18, 2015
1 parent beeacb0 commit 22c7e3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -12,6 +12,7 @@ Features
Bugfixes
--------

* Make LINK_CHECK_WHITELIST apply to remote link checks
* Make STORY_INDEX work together with PRETTY_URLS (Issue #1949)
* Refactor new_post to match lazy plugin loading (Issue #1943)
* Make Nikola startup faster by not loading useless plugins (Issue #1825)
Expand Down
5 changes: 5 additions & 0 deletions nikola/plugins/command/check.py
Expand Up @@ -227,6 +227,11 @@ def analyze(self, fname, find_sources=False, check_remote=False):
if self.checked_remote_targets[target] > 399:
self.logger.warn("Broken link in {0}: {1} [Error {2}]".format(filename, target, self.checked_remote_targets[target]))
continue

# Skip whitelisted targets
if any(re.search(_, target) for _ in self.whitelist):
continue

# Check the remote link works
req_headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 (Nikola)'} # I’m a real boy!
resp = requests.head(target, headers=req_headers)
Expand Down

0 comments on commit 22c7e3e

Please sign in to comment.