Test hidden page requests on page ID

Fixes #523
This commit is contained in:
Daniel Rudolf 2019-12-31 00:36:22 +01:00
parent 1d250a2f7c
commit 447479d973
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}