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

Serving _site plugins do not pick up on index.html for sub directories #4850

Closed
wants to merge 2 commits into from

Conversation

dadoonet
Copy link
Member

If one asks for http://es:9200/_plugin/PLUGIN_NAME/ and the the plugin's _site directory contains an index.html file, it will be correctly served.

This is not the case for sub directories: a _site/folder/index.html is not served when requesting http://es:9200/_plugin/PLUGIN_NAME/folder/ but one gets a 403 Forbidden response as if trying to browse the folder.

Closes #4845.

If one asks for `http://es:9200/_plugin/PLUGIN_NAME/` and the the plugin's _site directory contains an index.html file, it will be correctly served.

This is not the case for sub directories: a _site/folder/index.html is not served when requesting  `http://es:9200/_plugin/PLUGIN_NAME/folder/` but one gets a 403 Forbidden response as if trying to browse the folder.

Closes elastic#4845.
* @throws Exception
*/
@Test
public void testWelcomePageInSubDirs() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe also add a test for retrieving a directory without index.html?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would also test the direct retrieval of a file (not relevant to this change but we miss that one now and it will be good to have)

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. I thought the same but wondering if it should be part of another change. I think it makes sense to have it in this PR. Going to update.

@bleskes
Copy link
Contributor

bleskes commented Jan 23, 2014

Thanks david! looking good. left some comments

@dadoonet
Copy link
Member Author

Thanks @bleskes! I applied changes. WDYT?
BTW, in which branches should I push changes?

return;
}
// We don't serve dir but if index.html exists in dir we should serve it
file = new File(siteFile, sitePath + File.separatorChar + "index.html");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicking but I wonder if we should just use the File's constructor for this use case: http://docs.oracle.com/javase/7/docs/api/java/io/File.html#File(java.io.File, java.lang.String)

@bleskes
Copy link
Contributor

bleskes commented Jan 23, 2014

left one really minor comment. O.w. LGTM . I'd vote for pushing to 1.x and 0.90.x .

@dadoonet
Copy link
Member Author

Closed by f4411e6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serving _site plugins do not pick up on index.html for sub directories
3 participants