Skip to content

Commit a4e11e5

Browse files
committedMay 8, 2015
Fix #1695
1 parent 47cc127 commit a4e11e5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

Diff for: ‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Features
1010
Bugfixes
1111
--------
1212

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

1516
New in v7.4.0

Diff for: ‎nikola/nikola.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,16 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
992992
if url_type is None:
993993
url_type = self.config.get('URL_TYPE')
994994

995+
if dst_url.scheme and dst_url.scheme not in ['http', 'https', 'link']:
996+
return dst
997+
995998
# Refuse to replace links that are full URLs.
996999
if dst_url.netloc:
9971000
if dst_url.scheme == 'link': # Magic link
9981001
dst = self.link(dst_url.netloc, dst_url.path.lstrip('/'), lang)
1002+
# Assuming the site is served over one of these, and
1003+
# since those are the only URLs we want to rewrite...
9991004
else:
1000-
print(dst)
10011005
if '%' in dst_url.netloc:
10021006
# convert lxml percent-encoded garbage to punycode
10031007
nl = unquote(dst_url.netloc)
@@ -1006,15 +1010,13 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
10061010
except AttributeError:
10071011
# python 3: already unicode
10081012
pass
1009-
10101013
nl = nl.encode('idna')
10111014

10121015
dst = urlunsplit((dst_url.scheme,
10131016
nl,
10141017
dst_url.path,
10151018
dst_url.query,
10161019
dst_url.fragment))
1017-
print(dst)
10181020
return dst
10191021
elif dst_url.scheme == 'link': # Magic absolute path link:
10201022
dst = dst_url.path

0 commit comments

Comments
 (0)