Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 8f58062
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -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``
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -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'
Expand Down

0 comments on commit 8f58062

Please sign in to comment.