Browse Source

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 1 year ago
committed by GitHub
parent
commit
02452712a2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      apps/files_external/lib/Lib/Storage/SFTP.php

12
apps/files_external/lib/Lib/Storage/SFTP.php

@ -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;

Loading…
Cancel
Save