Skip to content
Permalink
Browse files

Merge pull request #2336 from getnikola/fix-2331

Fix #2331 -- fix folder handling/redirects in auto
  • Loading branch information
ralsina committed May 5, 2016
2 parents 76c75a0 + 2928646 commit 8f5806274b90dce10046dbaa968188f395bea4ed
Showing with 3 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +2 −2 nikola/plugins/command/auto/__init__.py
@@ -23,6 +23,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 8f58062

Please sign in to comment.