Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
doh
  • Loading branch information
ralsina committed Feb 21, 2017
1 parent f4ea4f4 commit b80e962
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -298,12 +298,8 @@ def serve_static(self, environ, start_response):
p_uri = urlparse(uri)
f_path = os.path.join(self.site.config['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(stripped_uri)[0] or 'application/octet-stream'
mimetype = 'text/html' if uri.endswith('/') else mimetypes.guess_type(p_uri.path)[0] or 'application/octet-stream'

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

0 comments on commit b80e962

Please sign in to comment.