diff options
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/FTP.php')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/FTP.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index ae02f37b575..623388048e7 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -123,7 +123,8 @@ class FTP extends Common { return $item['type'] === 'cdir'; })); if ($currentDir) { - $time = \DateTime::createFromFormat('YmdHis', $currentDir['modify'] ?? ''); + [$modify] = explode('.', $currentDir['modify'] ?? '', 2); + $time = \DateTime::createFromFormat('YmdHis', $modify); if ($time === false) { throw new \Exception("Invalid date format for directory: $currentDir"); } @@ -355,10 +356,11 @@ class FTP extends Common { $data = []; $data['mimetype'] = $isDir ? FileInfo::MIMETYPE_FOLDER : $mimeTypeDetector->detectPath($name); - $data['mtime'] = \DateTime::createFromFormat('YmdGis', $file['modify'])->getTimestamp(); - if ($data['mtime'] === false) { - $data['mtime'] = time(); - } + + // strip fractional seconds + [$modify] = explode('.', $file['modify'], 2); + $mtime = \DateTime::createFromFormat('YmdGis', $modify); + $data['mtime'] = $mtime === false ? time() : $mtime->getTimestamp(); if ($isDir) { $data['size'] = -1; //unknown } elseif (isset($file['size'])) { |