From 447479d973cde6263e87bcd0db65b37c51641875 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Tue, 31 Dec 2019 00:36:22 +0100 Subject: [PATCH] Test hidden page requests on page ID Fixes #523 --- lib/Pico.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Pico.php b/lib/Pico.php index 7b32854..3022714 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -455,8 +455,9 @@ class Pico // load raw file content $this->triggerEvent('onContentLoading'); + $requestedPageId = $this->getPageId($this->requestFile) ?: $this->requestFile; $hiddenFileRegex = '/(?:^|\/)(?:_|404' . preg_quote($this->getConfig('content_ext'), '/') . '$)/'; - if (is_file($this->requestFile) && !preg_match($hiddenFileRegex, $this->requestFile)) { + if (is_file($this->requestFile) && !preg_match($hiddenFileRegex, $requestedPageId)) { $this->rawContent = $this->loadFileContent($this->requestFile); } else { $this->triggerEvent('on404ContentLoading'); @@ -2330,14 +2331,12 @@ class Pico { $contentDir = $this->getConfig('content_dir'); $contentDirLength = strlen($contentDir); - if (substr($path, 0, $contentDirLength) !== $contentDir) { return null; } $contentExt = $this->getConfig('content_ext'); $contentExtLength = strlen($contentExt); - if (substr($path, -$contentExtLength) !== $contentExt) { return null; }