Skip to content
Snippets Groups Projects
Commit 391f267d authored by Vincent Petry's avatar Vincent Petry
Browse files

Merge pull request #5897 from hkjolhede/master

Fixed error-checking error in sftp.php
parents 19af45c7 3e2d4c1b
No related branches found
No related tags found
No related merge requests found
......@@ -94,15 +94,17 @@ class SFTP extends \OC\Files\Storage\Common {
private function writeHostKeys($keys) {
try {
$keyPath = $this->hostKeysPath();
$fp = fopen($keyPath, 'w');
foreach ($keys as $host => $key) {
fwrite($fp, $host . '::' . $key . "\n");
if ($keyPath && file_exists($keyPath)) {
$fp = fopen($keyPath, 'w');
foreach ($keys as $host => $key) {
fwrite($fp, $host . '::' . $key . "\n");
}
fclose($fp);
return true;
}
fclose($fp);
return true;
} catch (\Exception $e) {
return false;
}
return false;
}
private function readHostKeys() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment