sysutils/sftp-backup : remove carriage return for windows users and possible excess line endings, closes https://github.com/opnsense/plugins/issues/4582

This commit is contained in:
Ad Schellevis 2025-03-11 19:08:58 +01:00
parent 11bb18d97d
commit 00cb3e9dbe

View file

@ -178,7 +178,7 @@ class Sftp extends Base implements IBackupProvider
mkdir($confdir);
}
if (!is_file($identfile) || file_get_contents($identfile) != $this->model->privkey) {
File::file_put_contents($identfile, $this->model->privkey, 0600);
File::file_put_contents($identfile, trim(str_replace("\r", "", $this->model->privkey)) . "\n", 0600);
}
return $identfile;
}