Skip to content

Commit

Permalink
Merge pull request #46060 from nextcloud/backport/45938/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Do not log an error when connecting to SFTP without a logged in user
  • Loading branch information
AndyScherzinger authored Jul 11, 2024
2 parents 52718fe + c360c20 commit 1135d77
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/files_external/lib/Lib/Storage/SFTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ private function absPath($path) {
*/
private function hostKeysPath() {
try {
$storage_view = \OCP\Files::getStorage('files_external');
if ($storage_view) {
return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') .
$storage_view->getAbsolutePath('') .
'ssh_hostKeys';
$userId = \OC_User::getUser();
if ($userId === false) {
return false;
}

$view = new \OC\Files\View('/' . $userId . '/files_external');

return $view->getLocalFile('ssh_hostKeys');
} catch (\Exception $e) {
}
return false;
Expand Down

0 comments on commit 1135d77

Please sign in to comment.