Skip to content
Permalink
Browse files

Merge branch 'master' into do-1985

  • Loading branch information
ralsina committed Sep 1, 2015
2 parents 4edd6e0 + 4e0be1b commit e4b780693d6a54fb494c1685582864d89ee96ed8
Showing with 7 additions and 3 deletions.
  1. +1 −0 CHANGES.txt
  2. +1 −1 nikola/nikola.py
  3. +5 −2 nikola/plugins/command/check.py
@@ -28,6 +28,7 @@ Features
Bugfixes
--------

* Link checker should check all absolute URLs to self (Issue #1991)
* Check ``img|source[@srcset]`` as part of ``check -l`` (Issue #1989)
* Clean up translations for third party components
* ``pagekind["main_index"]`` set on the main indexes to differentiate
@@ -1106,7 +1106,7 @@ def rewrite_links(self, doc, src, lang):
doc.rewrite_links(lambda dst: self.url_replacer(src, dst, lang), resolve_base_href=False)

# lxml ignores srcset in img and source elements, so do that by hand
objs = list(doc.findall('(*//img|*//source)'))
objs = list(doc.xpath('(*//img|*//source)'))
for obj in objs:
if 'srcset' in obj.attrib:
urls = [u.strip() for u in obj.attrib['srcset'].split(',')]
@@ -217,6 +217,11 @@ def analyze(self, fname, find_sources=False, check_remote=False):
if target == "#":
continue
target, _ = urldefrag(target)

# absolute URL to root-relative
if target.startswith(base_url.geturl()):
target = target.replace(base_url.geturl(), '/')

parsed = urlparse(target)

# Warn about links from https to http (mixed-security)
@@ -229,8 +234,6 @@ def analyze(self, fname, find_sources=False, check_remote=False):
((parsed.scheme or target.startswith('//')) and url_type in ('rel_path', 'full_path')):
if not check_remote or parsed.scheme not in ["http", "https"]:
continue
if parsed.netloc == base_url.netloc: # absolute URL to self.site
continue
if target in self.checked_remote_targets: # already checked this exact target
if self.checked_remote_targets[target] in [301, 307]:
self.logger.warn("Remote link PERMANENTLY redirected in {0}: {1} [Error {2}]".format(filename, target, self.checked_remote_targets[target]))

0 comments on commit e4b7806

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