From b5dea84b11ab6c1230980cc8e2c1b3cfd63266a9 Mon Sep 17 00:00:00 2001 From: Peter Mathis Date: Wed, 23 Oct 2024 16:10:13 +0200 Subject: [PATCH] fix(pat contentbrowser): fix when no path (root, context) provided. --- src/pat/contentbrowser/src/App.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pat/contentbrowser/src/App.svelte b/src/pat/contentbrowser/src/App.svelte index 2d3ad6441..543952484 100644 --- a/src/pat/contentbrowser/src/App.svelte +++ b/src/pat/contentbrowser/src/App.svelte @@ -50,8 +50,14 @@ const currentPath = getContext("currentPath"); if (!$currentPath) { - // if root path is not above base path we start at rootPath - $currentPath = basePath.indexOf(rootPath) != 0 ? rootPath : basePath; + if(basePath || rootPath) { + // if root path is not above base path we start at rootPath + $currentPath = basePath.indexOf(rootPath) != 0 ? rootPath : basePath; + } else { + // no path available. try to determine path from vocabularyUrl + const vocabPath = new URL(vocabularyUrl).pathname.split("/"); + $currentPath = vocabPath.slice(0, vocabPath.length - 1).join("/"); + } } let config = getContext("config");