]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files_external): Check key exists before accessing it 47974/head
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>
Sat, 14 Sep 2024 09:21:17 +0000 (11:21 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Sat, 14 Sep 2024 16:54:43 +0000 (16:54 +0000)
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
apps/files_external/lib/Lib/Storage/SFTP.php

index a25829d6baf7bc933dfd356fdcf435a5f22aeaad..ac568702a93b2f2f2874a6466ac1b2a008d9c17f 100644 (file)
@@ -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;
                }