From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Sat, 14 Sep 2024 09:21:17 +0000 (+0200) Subject: fix(files_external): Check key exists before accessing it X-Git-Tag: v29.0.8rc1~83^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=61684129e18fa029927fb464d90fa3f398c4f302;p=nextcloud-server.git fix(files_external): Check key exists before accessing it Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 850525cf6de..7fda192dbfc 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -471,10 +471,14 @@ class SFTP extends Common { try { $stat = $this->getConnection()->stat($this->absPath($path)); - $mtime = $stat ? (int)$stat['mtime'] : -1; - $size = $stat ? (int)$stat['size'] : 0; - - return ['mtime' => $mtime, 'size' => $size, 'ctime' => -1]; + $mtime = isset($stat['mtime']) ? (int)$stat['mtime'] : -1; + $size = isset($stat['size']) ? (int)$stat['size'] : 0; + + return [ + 'mtime' => $mtime, + 'size' => $size, + 'ctime' => -1 + ]; } catch (\Exception $e) { return false; }