Skip to content
Snippets Groups Projects
Commit 3e2d4c1b authored by hkjolhede's avatar hkjolhede
Browse files

Fixed error-checking error in sftp.php

parent 68f27802
No related branches found
No related tags found
No related merge requests found
...@@ -94,15 +94,17 @@ class SFTP extends \OC\Files\Storage\Common { ...@@ -94,15 +94,17 @@ class SFTP extends \OC\Files\Storage\Common {
private function writeHostKeys($keys) { private function writeHostKeys($keys) {
try { try {
$keyPath = $this->hostKeysPath(); $keyPath = $this->hostKeysPath();
$fp = fopen($keyPath, 'w'); if ($keyPath && file_exists($keyPath)) {
foreach ($keys as $host => $key) { $fp = fopen($keyPath, 'w');
fwrite($fp, $host . '::' . $key . "\n"); foreach ($keys as $host => $key) {
fwrite($fp, $host . '::' . $key . "\n");
}
fclose($fp);
return true;
} }
fclose($fp);
return true;
} catch (\Exception $e) { } catch (\Exception $e) {
return false;
} }
return false;
} }
private function readHostKeys() { 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