picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

404 on every page because of false positive hiddenFileRegex call on underscores in DocumentRoot #523

Closed sausix closed 4 years ago

sausix commented 4 years ago

File:

vendor/picocms/pico/lib/Pico.php

Line: $hiddenFileRegex = '/(?:^|\/)(?:_|404' . preg_quote($this->getConfig('content_ext'), '/') . '$)/';

Failing condition call: ... && !preg_match($hiddenFileRegex, $this->requestFile)) {

Config:

Apache: DocumentRoot /srv/http/_dynamic_/Pico
$this->requestFile : "/srv/http/_dynamic_/Pico/content/index.md"

That frustrated me some hours yesterday. Maybe it helps someone else.

lliv4evrr commented 4 years ago

I also encounter this issue. I have no idea how it affect the old user, or whether it just confuses new users like me.

PhrozenByte commented 4 years ago

This behaviour isn't really new (introduced with Pico 2.0), but I assume it's worth fixing nevertheless since there isn't really a point of checking the content dir path for underscores. See 447479d