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

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

@Kwpolska
Copy link
Member

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

@felixfontein
Copy link
Contributor Author

So, what do you suggest?

@ralsina
Copy link
Member

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

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 commented Feb 1, 2017

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

@felixfontein
Copy link
Contributor Author

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

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']?

Copy link
Contributor Author

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'?

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, merging.

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

Successfully merging this pull request may close these issues.

None yet

3 participants