From 020d2ecc2285c7b8ef33f908d211650b982ac566 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 26 Dec 2014 09:30:52 +0100 Subject: [PATCH] Fix QUrl porting error (missing fromLocalFile) and construct URL properly. (to escape things like usernames correctly) (cherry picked from commit f7322f8ecb921a86c9af2866d5689ec279e4e44f) --- src/Session.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Session.cpp b/src/Session.cpp index 8526e2b3..f813b112 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -991,12 +991,16 @@ QUrl Session::getUrl() if (_foregroundProcessInfo->name(&ok) == "ssh" && ok) { SSHProcessInfo sshInfo(*_foregroundProcessInfo); - path = "ssh://" + sshInfo.userName() + '@' + sshInfo.host(); + QUrl url; + url.setScheme("ssh"); + url.setUserName(sshInfo.userName()); + url.setHost(sshInfo.host()); - QString port = sshInfo.port(); + const QString port = sshInfo.port(); if (!port.isEmpty() && port != "22") { - path.append(':' + port); + url.setPort(port.toInt()); } + return url; } else { path = _foregroundProcessInfo->currentDir(&ok); if (!ok) @@ -1009,7 +1013,7 @@ QUrl Session::getUrl() } } - return QUrl(path); + return QUrl::fromLocalFile(path); } void Session::setIconName(const QString& iconName) -- GitLab