From bbb7ea3857011a44420e588ade8dfb7638bdfebf Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 22 Oct 2021 15:21:50 -0400 Subject: [PATCH] Fix issue in PagesPathFinder with required vs. disallowed trailing slash setting for root level pages --- wire/core/PagesPathFinder.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wire/core/PagesPathFinder.php b/wire/core/PagesPathFinder.php index fcc8518b..4283f65e 100644 --- a/wire/core/PagesPathFinder.php +++ b/wire/core/PagesPathFinder.php @@ -1163,9 +1163,12 @@ class PagesPathFinder extends Wire { $result['page'] = array_merge($result['page'], $row); $result['response'] = 200; $result['language']['name'] = 'default'; - + if($row['parent_id'] === 1) { - $path = "/$path/"; + $template = $this->wire()->templates->get($row['templates_id']); + $slashUrls = $template ? (int) $template->slashUrls : 0; + $slash = ($slashUrls ? $slashUrls > 0 : substr($path, -1) === '/'); + $path = "/$path" . ($slash ? '/' : ''); } else { // global unique, must redirect to its actual path $page = $this->pages->getOneById((int) $row['id'], array(