Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions apps/files_external/lib/Lib/Storage/Swift.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ public function opendir(string $path) {

public function stat(string $path): array|false {
$path = $this->normalizePath($path);

if ($path === '.') {
$path = '';
} elseif ($this->is_dir($path)) {
Expand All @@ -305,22 +304,23 @@ public function stat(string $path): array|false {
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) {
Expand Down
Loading