Skip to content

Commit

Permalink
Add only one slash before ? in serve
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 24, 2019
1 parent 0552489 commit 399e302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -8,6 +8,8 @@ Bugfixes
"ignored_assets" key in theme meta files (Issue #3210)
* Fix error when ``nikola new_post`` receives directory name as
path (Issue #3207)
* Add slashes to paths with query strings in ``nikola serve``
only if there isn’t one before ``?``
* Read listings files as UTF-8
* Set one-file status basing on default language only (Issue #3191)
* Don’t warn if post status is set to ``published`` explicitly
Expand Down
6 changes: 3 additions & 3 deletions nikola/plugins/command/serve.py
Expand Up @@ -215,11 +215,11 @@ def send_head(self):
path = self.translate_path(self.path)
f = None
if os.path.isdir(path):
if not self.path.endswith('/'):
path_parts = list(self.path.partition('?'))
if not path_parts[0].endswith('/'):
# redirect browser - doing basically what apache does
self.send_response(301)
path_parts = list(self.path.partition('?'))
path_parts[0] += '/'
self.send_response(301)
self.send_header("Location", ''.join(path_parts))
# begin no-cache patch
# For redirects. With redirects, caching is even worse and can
Expand Down

0 comments on commit 399e302

Please sign in to comment.