File tree 1 file changed +2
-8
lines changed
1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 19
19
use Amp \Http \Server \StaticContent \Internal \Precondition ;
20
20
use Amp \Pipeline \Pipeline ;
21
21
use function Amp \File \filesystem ;
22
- use function Amp \File \read ;
23
22
use function Amp \Http \formatDateHeader ;
24
23
25
24
final class DocumentRoot implements RequestHandler
@@ -554,18 +553,13 @@ public function setUseEtagInode(bool $useInode): void
554
553
555
554
public function setExpiresPeriod (int $ seconds ): void
556
555
{
557
- $ this ->expiresPeriod = ( $ seconds < 0 ) ? 0 : $ seconds ;
556
+ $ this ->expiresPeriod = \max ( 0 , $ seconds) ;
558
557
}
559
558
560
559
public function loadMimeFileTypes (string $ mimeFile ): void
561
560
{
562
561
$ 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 );
569
563
570
564
if (!\preg_match_all ('#\s*([a-z0-9]+)\s+([a-z0-9\-]+/[a-z0-9\-]+(?:\+[a-z0-9\-]+)?)#i ' , $ contents , $ matches )) {
571
565
throw new \Exception (
You can’t perform that action at this time.
0 commit comments