diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java index f99e13116a7..f9106fbc078 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedLocation.java @@ -107,11 +107,7 @@ public record NestedLocation(Path path, String nestedEntryName) { private static Path asPath(String locationPath) { return pathCache.computeIfAbsent(locationPath, (key) -> { - if (isWindows() && locationPath.length() > 2 && locationPath.charAt(2) == ':') { - // Use the same logic as Java's internal WindowsUriSupport class - return Path.of(locationPath.substring(1)); - } - return Path.of(locationPath); + return Path.of((!isWindows()) ? locationPath : fixWindowsLocationPath(locationPath)); }); } @@ -119,6 +115,18 @@ public record NestedLocation(Path path, String nestedEntryName) { return File.separatorChar == '\\'; } + private static String fixWindowsLocationPath(String locationPath) { + // Same logic as Java's internal WindowsUriSupport class + if (locationPath.length() > 2 && locationPath.charAt(2) == ':') { + return locationPath.substring(1); + } + // Deal with Jetty's org.eclipse.jetty.util.URIUtil#correctURI(URI) + if (locationPath.startsWith("///") && locationPath.charAt(4) == ':') { + return locationPath.substring(3); + } + return locationPath; + } + static void clearCache() { locationCache.clear(); pathCache.clear();