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

Commit 94a5939

Browse files
committed
root fix
1 parent 57275ee commit 94a5939

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ public final File getFile(final String path){
248248
// if not top level directory or if not child of directory folder, then return null file
249249
if(!pabs.equals(dabs) && (!isWalkthrough || !pabs.startsWith(dabs))) return null;
250250

251-
final String fileName = new File(dabs + relative).getName();
251+
final File targetFile = Paths.get(dabs,relative).toFile();
252+
final String fileName = targetFile.getParentFile() == null ? targetFile.getPath() : targetFile.getName();
252253

253254
// for each file in parent directory, run adapter to find file that matches adapted name
254255
for(final File file : Objects.requireNonNullElse(parentFile.listFiles(), new File[0]))

0 commit comments

Comments
 (0)