Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1926 from getnikola/fix-1925
unquote paths in nikola auto
  • Loading branch information
ralsina committed Aug 5, 2015
2 parents 046bc8f + 4a5a677 commit ac9e088
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -9,6 +9,7 @@ Features
Bugfixes
--------

* Handle special characters in URLs in nikola auto (Issue #1925)
* Avoid Broken Pipe error in nikola auto (Issue #1906)
* "nikola auto" serving implicit index.html with wrong mime type (Issue #1921)
* Handle non-integer shutter speeds and other variables in WordPress
Expand Down
5 changes: 3 additions & 2 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -37,8 +37,9 @@
import time
try:
from urlparse import urlparse
from urllib2 import unquote
except ImportError:
from urllib.parse import urlparse # NOQA
from urllib.parse import urlparse, unquote # NOQA
import webbrowser
from wsgiref.simple_server import make_server
import wsgiref.util
Expand Down Expand Up @@ -286,7 +287,7 @@ def serve_static(self, environ, start_response):
"""Trivial static file server."""
uri = wsgiref.util.request_uri(environ)
p_uri = urlparse(uri)
f_path = os.path.join(self.site.config['OUTPUT_FOLDER'], *p_uri.path.split('/'))
f_path = os.path.join(self.site.config['OUTPUT_FOLDER'], *[unquote(x) for x in p_uri.path.split('/')])

# ‘Pretty’ URIs and root are assumed to be HTML
mimetype = 'text/html' if uri.endswith('/') else mimetypes.guess_type(uri)[0] or 'application/octet-stream'
Expand Down

0 comments on commit ac9e088

Please sign in to comment.