Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 f2b0b76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions nikola/nikola.py
Expand Up @@ -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:
Expand Down

0 comments on commit f2b0b76

Please sign in to comment.