Skip to content
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

Merged
merged 3 commits into from Feb 2, 2017

Conversation

@felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Jan 29, 2017

Fixes bug described in #2649, when .html is added to TAGS_INDEX_PATH.

@Kwpolska
Copy link
Member

@Kwpolska Kwpolska commented Jan 30, 2017

That will break the five sites which used tags/index to work around the bug.

@felixfontein
Copy link
Contributor Author

@felixfontein felixfontein commented Jan 30, 2017

So, what do you suggest?

@ralsina
Copy link
Member

@ralsina ralsina commented Jan 31, 2017

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?

@felixfontein
Copy link
Contributor Author

@felixfontein felixfontein commented Jan 31, 2017

Changing input parameters sounds bad to me. What if someone really wants output/tag/index without any file extension? It won't be possible anymore.

How about printing a warning if the path ends with /index? People can then choose to ignore it, or fix the problem when they notice the warning.

@Kwpolska
Copy link
Member

@Kwpolska Kwpolska commented Feb 1, 2017

No, nobody would want output/tag/index. It’s nonsense.

@felixfontein
Copy link
Contributor Author

@felixfontein felixfontein commented Feb 1, 2017

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]
Copy link
Member

@Kwpolska Kwpolska Feb 2, 2017

Is this fixing outdated code that does provides eg. ['rss.xml'] instead of ['rss']?

Copy link
Contributor Author

@felixfontein felixfontein Feb 2, 2017

You mean like sections.py which had return result + ['rss'], 'never', which now is return result + ['rss.xml'], 'never'?

Copy link
Member

@Kwpolska Kwpolska Feb 2, 2017

I’ll ask another way: why do you need splitext here and you didn’t in the past?

Copy link
Contributor Author

@felixfontein felixfontein Feb 2, 2017

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.

Copy link
Member

@Kwpolska Kwpolska Feb 2, 2017

Got it, merging.

@Kwpolska Kwpolska merged commit eebfbfb into master Feb 2, 2017
2 of 5 checks passed
@Kwpolska Kwpolska deleted the fix-wrong-behavior-of-never branch Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants