frdel commited on
Commit
b023d34
·
1 Parent(s): 7311a74

more forgiving component path

Browse files
Files changed (1) hide show
  1. webui/js/components.js +2 -1
webui/js/components.js CHANGED
@@ -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;
 
34
 
35
  // get html from cache or fetch it
36
  let html;
 
30
  targetElement.innerHTML = '<div class="loading"></div>';
31
 
32
  // full component url
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;