Skip to content

Commit

Permalink
[libssu] Dont use QString.arg() with an empty string. Fixes JB#51400
Browse files Browse the repository at this point in the history
Previously we tried to replace the username placeholder in "home-url"
even when the homeUrl was empty this resulted in messages like this
when trying to register via `ssu r`:

Username: user
Password:
DBus unavailable, falling back to libssu
QString::arg: Argument missing: , user
Operation successful (direct)

Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
  • Loading branch information
Thaodan committed Oct 27, 2020
1 parent 639b463 commit 14a20f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libssu/ssu.cpp
Expand Up @@ -490,11 +490,11 @@ void Ssu::sendRegistration(const QString &usernameDomain, const QString &passwor
manager->post(request, form.query(QUrl::FullyEncoded).toStdString().c_str());
// we could expose downloadProgress() from reply in case we want progress info

QString homeUrl = settings->value("home-url").toString().arg(username);
QString homeUrl = settings->value("home-url").toString();
if (!homeUrl.isEmpty()) {
// clear header, the other request bits are reusable
request.setHeader(QNetworkRequest::ContentTypeHeader, 0);
request.setUrl(homeUrl + "/authorized_keys");
request.setUrl(homeUrl.arg(username) + "/authorized_keys");
ssuLog->print(LOG_DEBUG, QString("Trying to get SSH keys from %1").arg(request.url().toString()));
pendingRequests++;
manager->get(request);
Expand Down

0 comments on commit 14a20f3

Please sign in to comment.