fix autoindex at /

This commit is contained in:
Daniella 2022-07-09 11:22:30 +02:00
parent 971f7e75e1
commit 75a88a4c41
2 changed files with 7 additions and 0 deletions

View file

@ -138,6 +138,7 @@ public class BrowserContext {
InputStream stream = requestCatcher.getClass().getClassLoader().getResourceAsStream(file); InputStream stream = requestCatcher.getClass().getClassLoader().getResourceAsStream(file);
if(stream == null) { if(stream == null) {
if(new File(file).isDirectory() && path != null) { if(new File(file).isDirectory() && path != null) {
while(path.endsWith("/")) path = path.substring(0, path.length() - 1);
File[] files = new File(file).listFiles(); File[] files = new File(file).listFiles();
builder.append("<ul>"); builder.append("<ul>");
for(int i = 0; i < files.length; i++) { for(int i = 0; i < files.length; i++) {
@ -171,6 +172,7 @@ public class BrowserContext {
InputStream stream = requestCatcher.getClass().getClassLoader().getResourceAsStream(file); InputStream stream = requestCatcher.getClass().getClassLoader().getResourceAsStream(file);
if(stream == null) { if(stream == null) {
if(new File(file).isDirectory() && path != null) { if(new File(file).isDirectory() && path != null) {
while(path.endsWith("/")) path = path.substring(0, path.length() - 1);
File[] files = new File(file).listFiles(); File[] files = new File(file).listFiles();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("<ul>"); builder.append("<ul>");

View file

@ -39,3 +39,8 @@ input,button,select {
input.button,button,select { input.button,button,select {
border: 1px solid #cdd; border: 1px solid #cdd;
} }
a {
color: #fff;
text-decoration: underline dashed #888 1px;
}