From 4040e719823bfc95fc68a54c8a44fd9a5ca7c071 Mon Sep 17 00:00:00 2001 From: Marek Celuch Date: Thu, 23 Jan 2025 01:08:42 -0800 Subject: [PATCH] use different method to parse assets path --- .../digital/slovensko/autogram/server/AssetsEndpoint.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/digital/slovensko/autogram/server/AssetsEndpoint.java b/src/main/java/digital/slovensko/autogram/server/AssetsEndpoint.java index 6fb400d6..dba41f13 100644 --- a/src/main/java/digital/slovensko/autogram/server/AssetsEndpoint.java +++ b/src/main/java/digital/slovensko/autogram/server/AssetsEndpoint.java @@ -6,8 +6,10 @@ import digital.slovensko.autogram.server.errors.InvalidUrlParamException; import java.io.IOException; +import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.List; import static java.util.Objects.requireNonNull; @@ -16,7 +18,11 @@ public class AssetsEndpoint implements HttpHandler { private static final List assets; private static final Path assetsPath; static { - assetsPath = Path.of(requireNonNull(AssetsEndpoint.class.getResource("index.html")).getPath()).getParent().resolve("assets"); + try { + assetsPath = Paths.get(requireNonNull(AssetsEndpoint.class.getResource("index.html")).toURI()).getParent().resolve("assets"); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } assets = List.of( "swagger-ui-bundle-v5.11.0.js", "swagger-ui-v5.11.0.css"