Skip to content

Commit

Permalink
Fix resource path handling for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophB committed Jan 31, 2025
1 parent a946a1a commit 155fcbb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ public ResourcePathHttpHandler(PathMapper mapper) {

@Override
public void handle(HttpExchange exchange) throws IOException {
Path resourcePath = mapper.map(Path.of(exchange.getRequestURI().getRawPath()));
StringBuilder resourcePath = new StringBuilder();
mapper
.map(Path.of(exchange.getRequestURI().getRawPath()))
.iterator()
.forEachRemaining(p -> resourcePath.append("/").append(p.toString()));
try (InputStream resource =
ResourcePathHttpHandler.class.getResourceAsStream(resourcePath.toString())) {
assert resource != null;
Expand Down

0 comments on commit 155fcbb

Please sign in to comment.