From ff95aff3f06080359aeffc2637a20ddae4177983 Mon Sep 17 00:00:00 2001 From: Felix Weilbach Date: Mon, 19 Jul 2021 11:11:56 +0200 Subject: [PATCH] Use QStringLiteral instead of plain strings Signed-off-by: Felix Weilbach --- src/gui/creds/flow2auth.cpp | 6 +++--- src/gui/wizard/webview.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/creds/flow2auth.cpp b/src/gui/creds/flow2auth.cpp index 4c4245e5f1c00..468322138975a 100644 --- a/src/gui/creds/flow2auth.cpp +++ b/src/gui/creds/flow2auth.cpp @@ -79,7 +79,7 @@ void Flow2Auth::fetchNewToken(const TokenAction action) // Step 1: Initiate a login, do an anonymous POST request QUrl url = Utility::concatUrlPath(_account->url().toString(), QLatin1String("/index.php/login/v2")); - _enforceHttps = url.scheme() == "https"; + _enforceHttps = url.scheme() == QStringLiteral("https"); // add 'Content-Length: 0' header (see https://github.com/nextcloud/desktop/issues/1473) QNetworkRequest req; @@ -99,7 +99,7 @@ void Flow2Auth::fetchNewToken(const TokenAction action) && !json.isEmpty()) { pollToken = json.value("poll").toObject().value("token").toString(); pollEndpoint = json.value("poll").toObject().value("endpoint").toString(); - if (_enforceHttps && QUrl(pollEndpoint).scheme() != "https") { + if (_enforceHttps && QUrl(pollEndpoint).scheme() != QStringLiteral("https")) { qCWarning(lcFlow2auth) << "Can not poll endpoint because the returned url" << _pollEndpoint << "does not start with https"; emit result(Error, tr("The polling URL does not start with https despite the login URL started with https. Login will not be possible because this might be a security issue. Please contact your administrator.")); return; @@ -206,7 +206,7 @@ void Flow2Auth::slotPollTimerTimeout() if (reply->error() == QNetworkReply::NoError && jsonParseError.error == QJsonParseError::NoError && !json.isEmpty()) { serverUrl = json["server"].toString(); - if (_enforceHttps && serverUrl.scheme() != "https") { + if (_enforceHttps && serverUrl.scheme() != QStringLiteral("https")) { qCWarning(lcFlow2auth) << "Returned server url" << serverUrl << "does not start with https"; emit result(Error, tr("The returned server URL does not start with https despite the login URL started with https. Login will not be possible because this might be a security issue. Please contact your administrator.")); return; diff --git a/src/gui/wizard/webview.cpp b/src/gui/wizard/webview.cpp index f6560ddc1af38..26c9e2107c689 100644 --- a/src/gui/wizard/webview.cpp +++ b/src/gui/wizard/webview.cpp @@ -194,7 +194,7 @@ QWebEnginePage * WebEnginePage::createWindow(QWebEnginePage::WebWindowType type) void WebEnginePage::setUrl(const QUrl &url) { QWebEnginePage::setUrl(url); - _enforceHttps = url.scheme() == "https"; + _enforceHttps = url.scheme() == QStringLiteral("https"); } bool WebEnginePage::certificateError(const QWebEngineCertificateError &certificateError) @@ -220,7 +220,7 @@ bool WebEnginePage::certificateError(const QWebEngineCertificateError &certifica bool WebEnginePage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType /*type*/, bool /*isMainFrame*/) { - if (_enforceHttps && url.scheme() != "https") { + if (_enforceHttps && url.scheme() != QStringLiteral("https")) { QMessageBox::warning(nullptr, "Security warning", "Can not follow non https link on a https website. This might be a security issue. Please contact your administrator"); return false; }