File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -601,7 +601,7 @@ public function mimeType()
601601 */
602602 public function lastModified ()
603603 {
604- return Carbon::createFromTimestamp ($ this ->meta ('last_modified ' ), config ('app.timezone ' ));
604+ return Carbon::createFromTimestamp ($ this ->meta ('last_modified ' ) ?? 0 , config ('app.timezone ' ));
605605 }
606606
607607 /**
Original file line number Diff line number Diff line change @@ -663,6 +663,22 @@ public function it_gets_last_modified_time()
663663 $ this ->assertEquals (Carbon::parse ('2017-01-02 14:35:00 ' )->timestamp , $ lastModified ->timestamp );
664664 }
665665
666+ #[Test]
667+ public function it_returns_epoch_when_last_modified_meta_is_null ()
668+ {
669+ Storage::fake ('test ' );
670+ Storage::disk ('test ' )->put ('foo/test.txt ' , '' );
671+ Storage::disk ('test ' )->put ('foo/.meta/test.txt.yaml ' , YAML ::dump ([
672+ 'data ' => [],
673+ ]));
674+
675+ $ asset = (new Asset )->container ($ this ->container )->path ('foo/test.txt ' );
676+
677+ $ lastModified = $ asset ->lastModified ();
678+ $ this ->assertInstanceOf (Carbon::class, $ lastModified );
679+ $ this ->assertEquals (0 , $ lastModified ->timestamp );
680+ }
681+
666682 #[Test]
667683 public function it_generates_and_clears_meta_caches ()
668684 {
You can’t perform that action at this time.
0 commit comments