File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 1919use Amp \Http \Server \StaticContent \Internal \Precondition ;
2020use Amp \Pipeline \Pipeline ;
2121use function Amp \File \filesystem ;
22- use function Amp \File \read ;
2322use function Amp \Http \formatDateHeader ;
2423
2524final class DocumentRoot implements RequestHandler
@@ -554,18 +553,13 @@ public function setUseEtagInode(bool $useInode): void
554553
555554 public function setExpiresPeriod (int $ seconds ): void
556555 {
557- $ this ->expiresPeriod = ( $ seconds < 0 ) ? 0 : $ seconds ;
556+ $ this ->expiresPeriod = \max ( 0 , $ seconds) ;
558557 }
559558
560559 public function loadMimeFileTypes (string $ mimeFile ): void
561560 {
562561 $ mimeFile = \str_replace ('\\' , '/ ' , $ mimeFile );
563- $ contents = read ($ mimeFile );
564- if ($ contents === false ) {
565- throw new \Exception (
566- "Failed loading mime associations from file {$ mimeFile }"
567- );
568- }
562+ $ contents = $ this ->filesystem ->read ($ mimeFile );
569563
570564 if (!\preg_match_all ('#\s*([a-z0-9]+)\s+([a-z0-9\-]+/[a-z0-9\-]+(?:\+[a-z0-9\-]+)?)#i ' , $ contents , $ matches )) {
571565 throw new \Exception (
You can’t perform that action at this time.
0 commit comments