Don't read file contents of inaccessible pages
This commit is contained in:
parent
95db5ba1a1
commit
45815e2c6d
1 changed files with 7 additions and 7 deletions
14
lib/Pico.php
14
lib/Pico.php
|
@ -717,6 +717,13 @@ class Pico
|
|||
}
|
||||
|
||||
$id = substr($file, strlen($this->getConfig('content_dir')), -strlen($this->getConfig('content_ext')));
|
||||
|
||||
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
||||
$conflictFile = $this->getConfig('content_dir') . $id . '/index' . $this->getConfig('content_ext');
|
||||
if (in_array($conflictFile, $files, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = $this->getPageUrl($id);
|
||||
if ($file != $this->requestFile) {
|
||||
$rawContent = file_get_contents($file);
|
||||
|
@ -726,13 +733,6 @@ class Pico
|
|||
$meta = &$this->meta;
|
||||
}
|
||||
|
||||
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
||||
if (substr($id, -6) === '/index') {
|
||||
unset($pages[dirname($id)]);
|
||||
} elseif (isset($pages[$id . '/index'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// build page data
|
||||
// title, description, author and date are assumed to be pretty basic data
|
||||
// everything else is accessible through $page['meta']
|
||||
|
|
Loading…
Add table
Reference in a new issue