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

Commit 4ad8b17

Browse files
authored
Merge pull request #81 from Ktt-Development/fix-mismatched-slashes@39a9767
Fixed missing leading slashes for FileHandler
2 parents 39a9767 + 985b060 commit 4ad8b17

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
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.03</version>
9+
<version>03.05.04</version>
1010
<packaging>jar</packaging>
1111

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

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

Lines changed: 5 additions & 5 deletions
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.03
21+
* @version 03.05.04
2222
* @author Ktt Development
2323
*/
2424
class DirectoryEntry {
@@ -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)