Skip to content
Permalink
Browse files

Add only one slash before ? in serve

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information...
Kwpolska committed Jan 24, 2019
1 parent 0552489 commit 399e3025e70d3fb3f486e0645bf6b17c8b0e134c
Showing with 5 additions and 3 deletions.
  1. +2 −0 CHANGES.txt
  2. +3 −3 nikola/plugins/command/serve.py
@@ -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
@@ -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

0 comments on commit 399e302

Please sign in to comment.
You can’t perform that action at this time.