From e8207c683f680b425b72a069876fa5cc1f3484f0 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 27 Apr 2023 10:40:35 +1000 Subject: [PATCH] Fixes for directory resources in native mode --- .../undertow/runtime/KnownPathResourceManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java index fe426c649bf77..ee6069a65fdab 100644 --- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java +++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java @@ -134,7 +134,8 @@ public List list() { SortedSet dirSet = directories.tailSet(slashPath); for (var s : List.of(fileSet, dirSet)) { - for (String i : s) { + for (String file : s) { + var i = file; if (i.equals(slashPath)) { continue; } @@ -143,6 +144,9 @@ public List list() { if (!i.substring(slashPath.length()).contains("/")) { try { Resource resource = underlying.getResource(i); + if (resource == null && directories.contains(file)) { + resource = new DirectoryResource(file); + } if (resource == null) { throw new RuntimeException("Unable to get listed resource " + i + " from directory " + path + " for path " + slashPath + " from underlying manager " + underlying); @@ -212,4 +216,4 @@ public URL getUrl() { return null; } } -} \ No newline at end of file +}