Skip to content
Permalink
Browse files
Fix #2934 (spaces in link tags)
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Dec 17, 2017
1 parent 927a2b4 commit f2b0b7684be4771e7aed8dc7359c6a8996f110d5
Showing with 3 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +2 −2 nikola/nikola.py
@@ -27,6 +27,7 @@ Features
Bugfixes
--------

* Unquote paths given to ``link://`` magic URLs (Issue #2934)
* Specify UTF-8 input encoding for Mako as default (Issue #2930)
* Don't trigger rebuilds in auto mode for files it's safe to ignore
(Issue #2906)
@@ -1422,11 +1422,11 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
if dst_url.query:
# If query strings are used in magic link, they will be
# passed to the path handler as keyword arguments (strings)
link_kwargs = {k: v[-1] for k, v in parse_qs(dst_url.query).items()}
link_kwargs = {unquote(k): unquote(v[-1]) for k, v in parse_qs(dst_url.query).items()}
else:
link_kwargs = {}

dst = self.link(dst_url.netloc, dst_url.path.lstrip('/'), lang, **link_kwargs)
dst = self.link(dst_url.netloc, unquote(dst_url.path.lstrip('/')), lang, **link_kwargs)
# Assuming the site is served over one of these, and
# since those are the only URLs we want to rewrite...
else:

0 comments on commit f2b0b76

Please sign in to comment.