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

Fixed missing leading slashes for FileHandler #81

Merged
merged 2 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.kttdevelopment</groupId>
<artifactId>simplehttpserver</artifactId>
<version>03.05.03</version>
<version>03.05.04</version>
<packaging>jar</packaging>

<url>https://github.com/Ktt-Development/simplehttpserver</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @see FileHandler
* @see FileEntry
* @since 02.00.00
* @version 03.05.03
* @version 03.05.04
* @author Ktt Development
*/
class DirectoryEntry {
Expand Down Expand Up @@ -84,7 +84,7 @@ public final FileVisitResult visitFile(final Path path, final BasicFileAttribute

try{
preloadedFiles.put(
ContextUtil.joinContexts(false,false,relative, adapter.getName(file)),
ContextUtil.joinContexts(true,false,relative, adapter.getName(file)),
new FileEntry(file, adapter, loadingOption, true)
);
}catch(final UncheckedIOException ignored){ }
Expand Down Expand Up @@ -117,7 +117,7 @@ public final FileVisitResult visitFile(final Path path, final BasicFileAttribute

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

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

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