Merge pull request #46061 from nextcloud/backport/45938/stable29

[stable29] fix: Do not log an error when connecting to SFTP without a logged in user
This commit is contained in:
Andy Scherzinger 2024-07-10 20:31:42 +02:00 committed by GitHub
commit f22f127d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,12 +224,14 @@ class SFTP extends Common {
*/
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;