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 commented Jan 29, 2017

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

@Kwpolska
Copy link
Member

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 commented Jan 30, 2017

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

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

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

@felixfontein
Copy link
Contributor Author

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]

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Feb 2, 2017

Member

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

This comment has been minimized.

Copy link
@felixfontein

felixfontein Feb 2, 2017

Author Contributor

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

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Feb 2, 2017

Member

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

This comment has been minimized.

Copy link
@felixfontein

felixfontein Feb 2, 2017

Author Contributor

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.

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Feb 2, 2017

Member

Got it, merging.

@Kwpolska Kwpolska merged commit eebfbfb into master Feb 2, 2017
2 of 5 checks passed
2 of 5 checks passed
continuous-integration/travis-ci/push The Travis CI build failed
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.