Skip to content

Commit 44242f1

Browse files
authored
Merge pull request #1270 from gp247net/patch-1
Update LfmItem.php
2 parents 34ce440 + d0869e3 commit 44242f1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/LfmItem.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,18 @@ public function size()
110110

111111
public function time()
112112
{
113-
return $this->lfm->lastModified();
113+
// Avoid requesting lastModified for directories on S3-like drivers
114+
// because folders are virtual and may not have an object key.
115+
if ($this->isDirectory()) {
116+
return '';
117+
}
118+
119+
try {
120+
return $this->lfm->lastModified();
121+
} catch (\Throwable $e) {
122+
// Gracefully degrade if backend cannot retrieve metadata
123+
return '';
124+
}
114125
}
115126

116127
public function thumbUrl()

0 commit comments

Comments
 (0)