This repository was archived by the owner on Jul 31, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
src/main/java/com/kttdevelopment/simplehttpserver/handler Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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 */
2424class 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 }
You can’t perform that action at this time.
0 commit comments