From 4d5474db7bc2a573063415ff3e9156a605b67794 Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Wed, 6 Sep 2023 04:44:04 +0200 Subject: [PATCH] Fix SFTP plugin on Windows Broken by https://invent.kde.org/network/kdeconnect-android/-/merge_requests/320 --- plugins/sftp/sftpplugin-win.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/sftp/sftpplugin-win.cpp b/plugins/sftp/sftpplugin-win.cpp index 5450e5e3f..2f0d8ebef 100644 --- a/plugins/sftp/sftpplugin-win.cpp +++ b/plugins/sftp/sftpplugin-win.cpp @@ -50,10 +50,18 @@ void SftpPlugin::receivePacket(const NetworkPacket &np) QString path; if (np.has(QStringLiteral("multiPaths"))) { - path = QStringLiteral("/"); + QStringList paths = np.get(QStringLiteral("multiPaths")); + if (paths.size() == 1) { + path = paths[0]; + } else { + path = QStringLiteral("/"); + } } else { path = np.get(QStringLiteral("path")); } + if (!path.endsWith(QChar::fromLatin1('/'))) { + path += QChar::fromLatin1('/'); + } QString url_string = QStringLiteral("sftp://%1:%2@%3:%4%5") .arg(np.get(QStringLiteral("user")),