Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don’t use str.rstrip for removing /index.html
h/t @felixfontein

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 29, 2017
1 parent 3230953 commit 04cd8e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nikola/plugins/task/page_index.py
Expand Up @@ -65,7 +65,9 @@ def classify(self, post, lang):
"""Classify the given post for the given language."""
destpath = post.destination_path(lang, sep='/')
if post._has_pretty_url(lang):
destpath = destpath.rstrip('/index.html')
idx = '/index.html'
if destpath.endswith(idx):
destpath = destpath[:-len(idx)]
i = destpath.rfind('/')
return [destpath[:i] if i >= 0 else '']

Expand Down

0 comments on commit 04cd8e0

Please sign in to comment.