From c81e9e877645fc8c24f8443754314250f04a77a1 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 3 Apr 2021 13:05:20 +0200 Subject: [PATCH] fix --- core/Elements/Document.class.php | 4 ++++ core/core.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/Elements/Document.class.php b/core/Elements/Document.class.php index fb7a5fa..4d6decf 100644 --- a/core/Elements/Document.class.php +++ b/core/Elements/Document.class.php @@ -27,6 +27,10 @@ abstract class Document { public function getView() : ?View { + if ($this->activeView === null) { + return null; + } + $view = parseClass($this->activeView); $file = getClassPath($view); if(!file_exists($file) || !is_subclass_of($view, View::class)) { diff --git a/core/core.php b/core/core.php index b249352..a6e30fe 100644 --- a/core/core.php +++ b/core/core.php @@ -139,8 +139,8 @@ function serveStatic(string $webRoot, string $file): string { $pathInfo = pathinfo($path); - // TODO: add more file extensions here - $allowedExtension = array("html", "htm"); + // TODO: add more file extensions here, probably add them to settings? + $allowedExtension = array("html", "htm", "pdf"); $ext = $pathInfo["extension"] ?? ""; if (!in_array($ext, $allowedExtension)) { http_response_code(406);