forked from tilde.green/wiki
valid_page check was wrong again, it is supposed to check if the page name contains any invalid chars and that the .md file exists
This commit is contained in:
parent
b18575abb8
commit
e25acc1658
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ $parser = wiki::factory(true);
|
|||
$page = $_GET['page'];
|
||||
$page = preg_replace(',/$,', '', $page);
|
||||
$page = preg_replace(',/,', '-', $page);
|
||||
$valid_page = (preg_match("/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]*/", $page) && file_exists("pages/{$page}.md"));
|
||||
$valid_page = (!preg_match("/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]/", $page) && file_exists("pages/{$page}.md"));
|
||||
if ($page !== "" && !$valid_page) {
|
||||
http_response_code(404);
|
||||
echo "This wiki page doesn't exist, you'll be redirected to the homepage.\n";
|
||||
|
|
Loading…
Reference in a new issue