Skip to content

Commit

Permalink
Merge pull request #1399 from plone/contentbrowser-pathfix
Browse files Browse the repository at this point in the history
`pat-contentbrowser`: Fix when path is missing
  • Loading branch information
petschki authored Oct 23, 2024
2 parents 0af10ca + b5dea84 commit 0affb48
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pat/contentbrowser/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 0affb48

Please sign in to comment.