From 00cb3e9dbeb3ebc35641738f09dee805fb48450c Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 11 Mar 2025 19:08:58 +0100 Subject: [PATCH] sysutils/sftp-backup : remove carriage return for windows users and possible excess line endings, closes https://github.com/opnsense/plugins/issues/4582 --- .../src/opnsense/mvc/app/library/OPNsense/Backup/Sftp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysutils/sftp-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Sftp.php b/sysutils/sftp-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Sftp.php index 052783eb7..90c2e5aba 100644 --- a/sysutils/sftp-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Sftp.php +++ b/sysutils/sftp-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Sftp.php @@ -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; }