From d9fab273a8efb90c3db7747e3ccb25adc32cc951 Mon Sep 17 00:00:00 2001 From: Katsute <58778985+Katsute@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:20:46 -0400 Subject: [PATCH 1/2] Fix non matching contexts --- .../simplehttpserver/handler/DirectoryEntry.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java b/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java index e4f80e1..dd277a9 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java @@ -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){ } @@ -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){ } @@ -166,8 +166,8 @@ private Consumer> 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 From 985b060b9934204d98075564bf98dfc9ba028e49 Mon Sep 17 00:00:00 2001 From: Katsute <58778985+Katsute@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:26:15 -0400 Subject: [PATCH 2/2] version control --- pom.xml | 2 +- .../kttdevelopment/simplehttpserver/handler/DirectoryEntry.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cd749ad..02bf9da 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.kttdevelopment simplehttpserver - 03.05.03 + 03.05.04 jar https://github.com/Ktt-Development/simplehttpserver diff --git a/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java b/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java index dd277a9..fee24b8 100644 --- a/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java +++ b/src/main/java/com/kttdevelopment/simplehttpserver/handler/DirectoryEntry.java @@ -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 {