From 6cd6587f1552b894729e6ee0b6d26fad08400909 Mon Sep 17 00:00:00 2001 From: trendschau Date: Thu, 12 Dec 2024 23:09:14 +0100 Subject: [PATCH] Fixed bug when transform pages to posts (getFullDraftNavigation) --- system/typemill/Controllers/ControllerApiAuthorMeta.php | 5 +++-- system/typemill/Models/Navigation.php | 2 +- system/typemill/Models/Storage.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/system/typemill/Controllers/ControllerApiAuthorMeta.php b/system/typemill/Controllers/ControllerApiAuthorMeta.php index a838939..1a2e95a 100644 --- a/system/typemill/Controllers/ControllerApiAuthorMeta.php +++ b/system/typemill/Controllers/ControllerApiAuthorMeta.php @@ -130,6 +130,7 @@ class ControllerApiAuthorMeta extends Controller $langattr = $this->settings['langattr']; $navigation = new Navigation(); $item = $navigation->getItemForUrl($params['url'], $urlinfo, $langattr); + if(!$item) { $response->getBody()->write(json_encode([ @@ -234,13 +235,13 @@ class ControllerApiAuthorMeta extends Controller # RECREATE ITEM AND NAVIGATION, because we rename filename first and later update the meta-content $draftNavigation = $navigation->getFullDraftNavigation($urlinfo, $this->settings['langattr']); $draftNavigation = $navigation->setActiveNaviItemsWithKeyPath($draftNavigation, $item->keyPathArray); - $item = $navigation->getItemWithKeyPath($draftNavigation, $item->keyPathArray); + $item = $navigation->getItemWithKeyPath($draftNavigation, $item->keyPathArray); } } # if folder has changed and contains pages instead of posts or posts instead of pages if($item->elementType == "folder" && isset($params['data']['contains']) && isset($metadata['meta']['contains']) && $this->hasChanged($params['data'], $metadata['meta'], 'contains')) - { + { if($meta->folderContainsFolders($item)) { $response->getBody()->write(json_encode([ diff --git a/system/typemill/Models/Navigation.php b/system/typemill/Models/Navigation.php index 4943ab1..3fb8d18 100644 --- a/system/typemill/Models/Navigation.php +++ b/system/typemill/Models/Navigation.php @@ -159,7 +159,7 @@ class Navigation extends Folder $foldername = $this->getNaviFileNameForPath($pageinfo['path']); - $draftNavigation = $this->getDraftNavigation($urlinfo, $langattr, $foldername); + $draftNavigation = $this->getFullDraftNavigation($urlinfo, $langattr, $foldername); if(!$draftNavigation) { return false; diff --git a/system/typemill/Models/Storage.php b/system/typemill/Models/Storage.php index 40f36cc..63bcb26 100644 --- a/system/typemill/Models/Storage.php +++ b/system/typemill/Models/Storage.php @@ -905,7 +905,7 @@ class Storage ################## public function transformPagesToPosts($folder) - { + { $filetypes = array('md', 'txt', 'yaml'); $result = true;