Improve detection of hidden files to serve 404 contents instead
Follow-up to 9b72b5c316b38129952a4d59af05a0138ca1a15a
This commit is contained in:
parent
8f7e4da53d
commit
1f35346f53
@ -344,11 +344,8 @@ class Pico
|
|||||||
// load raw file content
|
// load raw file content
|
||||||
$this->triggerEvent('onContentLoading', array(&$this->requestFile));
|
$this->triggerEvent('onContentLoading', array(&$this->requestFile));
|
||||||
|
|
||||||
if (
|
$hiddenFileRegex = '/(?:^|\/)(?:_|404' . preg_quote($this->getConfig('content_ext'), '/') . '$)/';
|
||||||
file_exists($this->requestFile)
|
if (file_exists($this->requestFile) && !preg_match($hiddenFileRegex, $this->requestFile)) {
|
||||||
&& (basename($this->requestFile) !== '404' . $this->getConfig('content_ext'))
|
|
||||||
&& !preg_match('/(?:^|\/)_/', $this->requestFile)
|
|
||||||
) {
|
|
||||||
$this->rawContent = $this->loadFileContent($this->requestFile);
|
$this->rawContent = $this->loadFileContent($this->requestFile);
|
||||||
} else {
|
} else {
|
||||||
$this->triggerEvent('on404ContentLoading', array(&$this->requestFile));
|
$this->triggerEvent('on404ContentLoading', array(&$this->requestFile));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user