more forgiving component path

frdel committed Sep 28, 2025 at 15:26 UTC 151900d294ce7d3b30165203195e7a5028e35169
1 file changed +2 -1
webui/js/components.js
+2 -1
@@ -30,7 +30,8 @@ export async function importComponent(path, targetElement) {
30 targetElement.innerHTML = '<div class="loading"></div>';
31
32 // full component url
33 - const componentUrl = "components/" + path;
33 + const trimmedPath = path.replace(/^\/+/, "");
34 + const componentUrl = trimmedPath.startsWith("components/") ? trimmedPath : "components/" + trimmedPath;
35
36 // get html from cache or fetch it
37 let html;