Skip to content
Browse files
Fix #2645 (h/t @Benaiah)
  • Loading branch information
ralsina committed Feb 21, 2017
1 parent 948df1e commit f4ea4f4968e5cfa18413d43507edd6a4509b95ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
@@ -16,6 +16,7 @@ Features

* Fix mimetype guessing in auto mode (Issue #2645)
* Fix filters.html5lib_xmllike for laters html5lib (Issue #2648)
* Skip the current post in post lists (Issue #2666)
* Fix poor performance when compiling multiple markdown documents with
@@ -298,8 +298,12 @@ def serve_static(self, environ, start_response):
p_uri = urlparse(uri)
f_path = os.path.join(['OUTPUT_FOLDER'], *[unquote(x) for x in p_uri.path.split('/')])

# mimetypes.guess_type can't handle query strings, so we need
# to strip the URI to only the path for mimetype guessing
stripped_uri = urlparse.urljoin(url, p_uri.path)

# ‘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'
mimetype = 'text/html' if uri.endswith('/') else mimetypes.guess_type(stripped_uri)[0] or 'application/octet-stream'

if os.path.isdir(f_path):
if not p_uri.path.endswith('/'): # Redirect to avoid breakage

0 comments on commit f4ea4f4

Please sign in to comment.