Merge pull request #45938 from nextcloud/do-not-log-an-error-when-connecting-to-sftp-without-a-logged-in-user

fix: Do not log an error when connecting to SFTP without a logged in user
pull/46062/head
Louis 2024-06-24 10:35:16 +07:00 committed by GitHub
commit 02452712a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 5 deletions

@ -194,12 +194,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;