Skip to content

Commit

Permalink
Fixes #352
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Dec 9, 2022
1 parent fae2762 commit 1b1436d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libs/Format/Confluence/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,20 @@ protected function getRootPage($tree)
{
if ($this->confluence->hasAncestorId()) {
$pages = $this->client->getList($this->confluence->getAncestorId());
$rootTitle = $tree['title'];

foreach ($pages as $page) {
if ($page['title'] == $tree['title']) {
if ($page['title'] == $rootTitle) {
return $page;
}
}

$pageNames = implode(
"', '",
array_map(function ($page) { return $page['title']; }, $pages)
);

throw new \RuntimeException("Could not find a page named '$rootTitle' but found ['$pageNames'].");
}

if ($this->confluence->hasRootId()) {
Expand Down

0 comments on commit 1b1436d

Please sign in to comment.