diff options
author | Louis <louis@chmn.me> | 2025-05-12 13:21:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-12 13:21:51 +0200 |
commit | a2eed985aa1266cb519d46c11f58e853eeb6c657 (patch) | |
tree | 8bf05f18247a7de1bc52152b282985a944f5e746 | |
parent | 7e9fc7604a891de10b507a8d8f5e6361671eb308 (diff) | |
parent | 2d68644e11a1df273a1b65e5d1f9e3a0c2ced604 (diff) | |
download | nextcloud-server-a2eed985aa1266cb519d46c11f58e853eeb6c657.tar.gz nextcloud-server-a2eed985aa1266cb519d46c11f58e853eeb6c657.zip |
Merge pull request #52686 from nextcloud/isNumericMtime
-rw-r--r-- | apps/files_external/lib/Lib/Storage/Swift.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index a71331766d4..e80570f14ba 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -288,7 +288,6 @@ class Swift extends Common { public function stat(string $path): array|false { $path = $this->normalizePath($path); - if ($path === '.') { $path = ''; } elseif ($this->is_dir($path)) { @@ -308,22 +307,23 @@ class Swift extends Common { return false; } - $dateTime = $object->lastModified ? \DateTime::createFromFormat(\DateTime::RFC1123, $object->lastModified) : false; - $mtime = $dateTime ? $dateTime->getTimestamp() : null; - $objectMetadata = $object->getMetadata(); - if (isset($objectMetadata['timestamp'])) { - $mtime = $objectMetadata['timestamp']; + $mtime = null; + if (!empty($object->lastModified)) { + $dateTime = \DateTime::createFromFormat(\DateTime::RFC1123, $object->lastModified); + if ($dateTime !== false) { + $mtime = $dateTime->getTimestamp(); + } } - if (!empty($mtime)) { - $mtime = floor($mtime); + if (is_numeric($object->getMetadata()['timestamp'] ?? null)) { + $mtime = (float)$object->getMetadata()['timestamp']; } - $stat = []; - $stat['size'] = (int)$object->contentLength; - $stat['mtime'] = $mtime; - $stat['atime'] = time(); - return $stat; + return [ + 'size' => (int)$object->contentLength, + 'mtime' => isset($mtime) ? (int)floor($mtime) : null, + 'atime' => time(), + ]; } public function filetype(string $path) { |