FIX empty 404 and source file access

An empty existing file triggered 404 error.

It was possible to get the source of any file (including .php).
This commit is contained in:
Christophe HENRY 2021-03-18 15:55:49 +01:00
parent 087c2b5e6c
commit b2e09c54f5
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ $fileContents = @file_get_contents($filePath);
######################################## 404 page
if (empty($fileContents)) {
if (!file_exists($filePath) || !preg_match("/\.gmi$/", $url)) {
error_log("HtmGem: 404 $url $filePath");
http_response_code(404); ?>
<!DOCTYPE html>