joerghoh commented on code in PR #26:
URL:
https://github.com/apache/sling-org-apache-sling-servlets-get/pull/26#discussion_r4539180338
##########
src/main/java/org/apache/sling/servlets/get/impl/helpers/StreamRenderer.java:
##########
@@ -301,6 +305,15 @@ private void renderDirectory(
setHeaders(fileRes, response);
+ final boolean noExtension = index.indexOf('.') < 0;
+
+ // An index resource without extension is rendered through
"<path>.html", so the
+ // response is always HTML, no matter which content type
setHeaders() determined for
+ // the resource itself. Do it before the HEAD check so HEAD
and GET report the same type.
+ if (noExtension) {
+ response.setContentType(CONTENT_TYPE_TEXT_HTML);
+ }
Review Comment:
Can you move that piece also below under der same condition?
```
if (noExtension) {
response.setContentType(CONTENT_TYPE_TEXT_HTML);
dispatcher = request.getRequestDispatcher(fileRes.getPath() + ".html",
rdo);
}
```
Then we have a logic at one place. I think that you can remove the comment
as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]