diff --git a/src/LfmItem.php b/src/LfmItem.php index e7f48747..3aeb0e13 100644 --- a/src/LfmItem.php +++ b/src/LfmItem.php @@ -110,7 +110,18 @@ public function size() public function time() { - return $this->lfm->lastModified(); + // Avoid requesting lastModified for directories on S3-like drivers + // because folders are virtual and may not have an object key. + if ($this->isDirectory()) { + return ''; + } + + try { + return $this->lfm->lastModified(); + } catch (\Throwable $e) { + // Gracefully degrade if backend cannot retrieve metadata + return ''; + } } public function thumbUrl()