Skip to content
Browse files
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 ac9e0888db34f0ea4eec1da5c690b70ff3a76c6a
Showing 2 changed files with 4 additions and 2 deletions.
@@ -9,6 +9,7 @@ Features

* 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
@@ -37,8 +37,9 @@
import time
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
@@ -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(['OUTPUT_FOLDER'], *p_uri.path.split('/'))
f_path = os.path.join(['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'

0 comments on commit ac9e088

Please sign in to comment.