Fix SFTP plugin on Windows

Broken by https://invent.kde.org/network/kdeconnect-android/-/merge_requests/320
This commit is contained in:
Albert Vaca Cintora 2023-09-06 04:44:04 +02:00
parent 17519fdb7a
commit 4d5474db7b

View file

@ -50,10 +50,18 @@ void SftpPlugin::receivePacket(const NetworkPacket &np)
QString path; QString path;
if (np.has(QStringLiteral("multiPaths"))) { if (np.has(QStringLiteral("multiPaths"))) {
QStringList paths = np.get<QStringList>(QStringLiteral("multiPaths"));
if (paths.size() == 1) {
path = paths[0];
} else {
path = QStringLiteral("/"); path = QStringLiteral("/");
}
} else { } else {
path = np.get<QString>(QStringLiteral("path")); path = np.get<QString>(QStringLiteral("path"));
} }
if (!path.endsWith(QChar::fromLatin1('/'))) {
path += QChar::fromLatin1('/');
}
QString url_string = QStringLiteral("sftp://%1:%2@%3:%4%5") QString url_string = QStringLiteral("sftp://%1:%2@%3:%4%5")
.arg(np.get<QString>(QStringLiteral("user")), .arg(np.get<QString>(QStringLiteral("user")),