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

Commit d9fab27

Browse files
committed
Fix non matching contexts
1 parent 39a9767 commit d9fab27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public final FileVisitResult visitFile(final Path path, final BasicFileAttribute
8484

8585
try{
8686
preloadedFiles.put(
87-
ContextUtil.joinContexts(false,false,relative, adapter.getName(file)),
87+
ContextUtil.joinContexts(true,false,relative, adapter.getName(file)),
8888
new FileEntry(file, adapter, loadingOption, true)
8989
);
9090
}catch(final UncheckedIOException ignored){ }
@@ -117,7 +117,7 @@ public final FileVisitResult visitFile(final Path path, final BasicFileAttribute
117117

118118
try{
119119
preloadedFiles.put(
120-
ContextUtil.joinContexts(false,false,relative,adapter.getName(file)),
120+
ContextUtil.joinContexts(true,false,relative,adapter.getName(file)),
121121
new FileEntry(file, adapter, ByteLoadingOption.PRELOAD)
122122
);
123123
}catch(final RuntimeException ignored){ }
@@ -166,8 +166,8 @@ private Consumer<WatchEvent<?>> createWatchServiceConsumer(final Path path){
166166
final WatchEvent.Kind<?> type = event.kind();
167167

168168
final String top2sub = ContextUtil.getContext(directoryPath.relativize(path).toString(),true,false); // the relative path between the top level directory and sub directory
169-
final String context = ContextUtil.joinContexts(false,false,top2sub,adapter.getName(relFile)); // the file key
170-
final File file = new File(directoryPath + ContextUtil.joinContexts(false,false,top2sub,relFile.getName())); // the actual referable file
169+
final String context = ContextUtil.joinContexts(true,false,top2sub,adapter.getName(relFile)); // the file key
170+
final File file = new File(ContextUtil.joinContexts(true,false,directoryPath.toString(),top2sub,relFile.getName())); // the actual referable file
171171
final Path target = file.toPath();
172172

173173
if(!file.isDirectory()) // File#isFile does not work

0 commit comments

Comments
 (0)