Skip to content
Permalink
Browse files

Fix #1695

  • Loading branch information
ralsina committed May 8, 2015
1 parent 47cc127 commit a4e11e5a40dd0b579ee3b50354bb95b1d2abd977
Showing with 6 additions and 3 deletions.
  1. +1 −0 CHANGES.txt
  2. +5 −3 nikola/nikola.py
@@ -10,6 +10,7 @@ Features
Bugfixes
--------

* Handle strange URLs, like ed2k:// (Issue #1695)
* Fix very old metadata format support (Issue #1689)

New in v7.4.0
@@ -992,12 +992,16 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
if url_type is None:
url_type = self.config.get('URL_TYPE')

if dst_url.scheme and dst_url.scheme not in ['http', 'https', 'link']:
return dst

# Refuse to replace links that are full URLs.
if dst_url.netloc:
if dst_url.scheme == 'link': # Magic link
dst = self.link(dst_url.netloc, dst_url.path.lstrip('/'), lang)
# Assuming the site is served over one of these, and
# since those are the only URLs we want to rewrite...
else:
print(dst)
if '%' in dst_url.netloc:
# convert lxml percent-encoded garbage to punycode
nl = unquote(dst_url.netloc)
@@ -1006,15 +1010,13 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
except AttributeError:
# python 3: already unicode
pass

nl = nl.encode('idna')

dst = urlunsplit((dst_url.scheme,
nl,
dst_url.path,
dst_url.query,
dst_url.fragment))
print(dst)
return dst
elif dst_url.scheme == 'link': # Magic absolute path link:
dst = dst_url.path

0 comments on commit a4e11e5

Please sign in to comment.