From e062cba0d07e5e70f501bd4194bf328d4f76f56e Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 15 Apr 2025 14:51:16 +0200 Subject: [PATCH] RemoteLinux: Read public key more directly Change-Id: I38faa3be91e615571f02d51a721ea858b5f70298 Reviewed-by: Christian Kandeler --- src/plugins/remotelinux/publickeydeploymentdialog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index 99805afa22f..4bbf24a29d2 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -67,14 +67,14 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const DeviceConstRef &devic handleDeploymentDone(result); }); - FileReader reader; - if (!reader.fetch(publicKeyFileName)) { - handleDeploymentDone(ResultError(Tr::tr("Public key error: %1").arg(reader.errorString()))); + const Result publicKey = publicKeyFileName.fileContents(); + if (!publicKey) { + handleDeploymentDone(ResultError(Tr::tr("Public key error: %1").arg(publicKey.error()))); return; } const QString command = "test -d .ssh || mkdir -p ~/.ssh && chmod 0700 .ssh && echo '" - + QString::fromLocal8Bit(reader.data()) + + QString::fromLocal8Bit(publicKey.value()) + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys"; const SshParameters params = device.sshParameters();