Skip to content

Commit

Permalink
Merge pull request #55 from nox7/fix-null-file-error
Browse files Browse the repository at this point in the history
Move file contents check to new if block
  • Loading branch information
nox7 committed Sep 6, 2023
2 parents bdcd2e5 + 8076191 commit 9adf75f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ public function processRequestAsStaticFile(): void{
if ($mimeType !== null) {
$staticFilePath = $this->noxInstance->staticFileHandler->getFullStaticFilePath($this->requestPath);
if ($staticFilePath !== null) {
$fileContents = file_get_contents(realpath($staticFilePath));
header("content-length: " . strlen($fileContents));

if (file_exists($staticFilePath) && !is_dir($staticFilePath)){

$fileContents = file_get_contents(realpath($staticFilePath));
header("content-length: " . strlen($fileContents));

/**
* Set the cache-control header for the given mime type if there is a cache
* setting for that mime type.
Expand Down

0 comments on commit 9adf75f

Please sign in to comment.