New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preventing .html to be added when it shouldn't be. #2652
Conversation
That will break the five sites which used |
So, what do you suggest? |
I know it's ugly but ... maybe check if it already ends with ".html" and if so, don't? Or maybe check if the user has configured something like "tags/index" and in that case do a fix to "tags/index.html", show a warning? |
Changing input parameters sounds bad to me. What if someone really wants How about printing a warning if the path ends with |
No, nobody would want |
How about the solution in 590736c? |
@@ -240,10 +240,12 @@ def _postprocess_path(self, path, lang, append_index='auto', dest_type='page', p | |||
path = ['rss'] | |||
elif len(path) == 0 or append_index == 'always': | |||
path = path + [os.path.splitext(self.site.config['INDEX_FILE'])[0]] | |||
elif len(path) > 0 and append_index == 'never': | |||
path[-1] = os.path.splitext(path[-1])[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fixing outdated code that does provides eg. ['rss.xml']
instead of ['rss']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like sections.py
which had return result + ['rss'], 'never'
, which now is return result + ['rss.xml'], 'never'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll ask another way: why do you need splitext here and you didn’t in the past?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in the past, part of the code assumed that 'never'
never had the extension there, while other parts assumed that it had. This code assumed it wasn't there so it could simply add it. Now 'never'
means "change extension if necessary", so now it needs splitext
to get rid of the old one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, merging.
Fixes bug described in #2649, when
.html
is added toTAGS_INDEX_PATH
.