Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #1705 from getnikola/flog-the-donkey
- Loading branch information
Showing
with
6 additions
and
3 deletions.
-
+1
−0
CHANGES.txt
-
+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 |
|
|