Skip to content
Permalink
Browse files

Fix #2331 -- fix folder handling/redirects in auto

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 5, 2016
1 parent a27143b commit 29286464e28c08c9decb1cca9b11f5bd9fc572b3
Showing with 3 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +2 −2 nikola/plugins/command/auto/__init__.py
@@ -9,6 +9,7 @@ Features
Bugfixes
--------

* Fix folder handling and redirects in ``nikola auto`` (Issue #2331)
* Use state files in ``nikola github_deploy`` and ``nikola status``
(Issue #2317)
* Add ``align`` options for ``youtube``, ``vimeo``, ``soundcloud``
@@ -302,8 +302,8 @@ def serve_static(self, environ, start_response):
mimetype = 'text/html' if uri.endswith('/') else mimetypes.guess_type(uri)[0] or 'application/octet-stream'

if os.path.isdir(f_path):
if not f_path.endswith('/'): # Redirect to avoid breakage
start_response('301 Redirect', [('Location', p_uri.path + '/')])
if not p_uri.path.endswith('/'): # Redirect to avoid breakage
start_response('301 Moved Permanently', [('Location', p_uri.path + '/')])
return []
f_path = os.path.join(f_path, self.site.config['INDEX_FILE'])
mimetype = 'text/html'

0 comments on commit 2928646

Please sign in to comment.