]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files_external): Check key exists before accessing it 47975/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:56:05 +0000 (16:56 +0000)
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
apps/files_external/lib/Lib/Storage/SFTP.php

index 850525cf6de222a0f6361916c900757a94285fde..7fda192dbfc16b2e30e2f71e7511b3b0e9512bb6 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;
                }