Skip to content
Permalink
Browse files

Skip remote links in LINK_CHECK_WHITELIST

  • Loading branch information
da2x committed Aug 18, 2015
1 parent beeacb0 commit 22c7e3e2169fb8e8b70eefe3ca905835126d10ae
Showing with 6 additions and 0 deletions.
  1. +1 −0 CHANGES.txt
  2. +5 −0 nikola/plugins/command/check.py
@@ -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)
@@ -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)

0 comments on commit 22c7e3e

Please sign in to comment.
You can’t perform that action at this time.