Skip to content

Commit

Permalink
fix(files_external): Check key exists before accessing it
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
  • Loading branch information
solracsf authored and backportbot[bot] committed Sep 14, 2024
1 parent 0b65a3e commit dd42b6c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/files_external/lib/Lib/Storage/SFTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,14 @@ public function stat($path) {
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;
}
Expand Down

0 comments on commit dd42b6c

Please sign in to comment.