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
Conversation
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 { |
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.
maybe also add a test for retrieving a directory without index.html?
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 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)
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 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.
Thanks david! looking good. left some comments |
Thanks @bleskes! I applied changes. WDYT? |
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"); |
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.
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)
left one really minor comment. O.w. LGTM . I'd vote for pushing to 1.x and 0.90.x . |
Closed by f4411e6 |
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.