mirror of
https://github.com/nextcloud/server.git
synced 2026-03-03 05:51:07 -05:00
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:
commit
f22f127d3e
1 changed files with 7 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue