Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit 57275ee

Browse files
committed
Fixed #84
1 parent ec30cf9 commit 57275ee

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.kttdevelopment</groupId>
88
<artifactId>simplehttpserver</artifactId>
9-
<version>03.05.05</version>
9+
<version>03.05.06</version>
1010
<packaging>jar</packaging>
1111

1212
<url>https://github.com/Ktt-Development/simplehttpserver</url>

src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @see FileHandler
1919
* @see FileEntry
2020
* @since 02.00.00
21-
* @version 03.05.04
21+
* @version 03.05.06
2222
* @author Ktt Development
2323
*/
2424
class DirectoryEntry {
@@ -254,6 +254,8 @@ public final File getFile(final String path){
254254
for(final File file : Objects.requireNonNullElse(parentFile.listFiles(), new File[0]))
255255
if(!file.isDirectory() && adapter.getName(file).equals(fileName))
256256
return file;
257+
else if(file.isDirectory() && file.getName().equals(fileName)) // directories are not subject to adapter names
258+
return file;
257259
return null;
258260
}
259261
}
@@ -275,7 +277,7 @@ public final byte[] getBytes(final String path){
275277
}else{
276278
try{
277279
final File file = Objects.requireNonNull(getFile(path)); // find if file allowed
278-
return adapter.getBytes(file,Files.readAllBytes(file.toPath())); // adapt bytes here
280+
return !file.isDirectory() ? adapter.getBytes(file,Files.readAllBytes(file.toPath())) : null; // adapt bytes here
279281
}catch(final NullPointerException | IOException ignored){
280282
return null;
281283
}

0 commit comments

Comments
 (0)