Skip to content

Commit

Permalink
Merge pull request #45938 from nextcloud/do-not-log-an-error-when-con…
Browse files Browse the repository at this point in the history
…necting-to-sftp-without-a-logged-in-user

fix: Do not log an error when connecting to SFTP without a logged in user
  • Loading branch information
artonge authored Jun 24, 2024
2 parents 4680bc4 + 733e3f6 commit 0245271
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 @@ -194,12 +194,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 0245271

Please sign in to comment.