diff options
author | alex-z <blackslayer4@gmail.com> | 2021-10-29 17:56:29 +0300 |
---|---|---|
committer | allexzander (Rebase PR Action) <allexzander@users.noreply.github.com> | 2021-11-02 11:54:06 +0300 |
commit | c52718c104d69e054371e407e96ab1e132895772 (patch) | |
tree | 8942af619ba3ba71ffc974cb7cd4f055c2e3d34b /src/gui/creds | |
parent | e4eaf9d88d2f69c49e804ed993e7dbb7f0fbeefe (diff) |
Replace deprecated QRegExp with QRegularExpression.
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src/gui/creds')
-rw-r--r-- | src/gui/creds/oauth.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/creds/oauth.cpp b/src/gui/creds/oauth.cpp index 2c0e20410..aa528aa49 100644 --- a/src/gui/creds/oauth.cpp +++ b/src/gui/creds/oauth.cpp @@ -70,13 +70,14 @@ void OAuth::start() QByteArray peek = socket->peek(qMin(socket->bytesAvailable(), 4000LL)); //The code should always be within the first 4K if (peek.indexOf('\n') < 0) return; // wait until we find a \n - QRegExp rx("^GET /\\?code=([a-zA-Z0-9]+)[& ]"); // Match a /?code=... URL - if (rx.indexIn(peek) != 0) { + const QRegularExpression rx("^GET /\\?code=([a-zA-Z0-9]+)[& ]"); // Match a /?code=... URL + const auto rxMatch = rx.match(peek); + if (!rxMatch.hasMatch()) { httpReplyAndClose(socket, "404 Not Found", "<html><head><title>404 Not Found</title></head><body><center><h1>404 Not Found</h1></center></body></html>"); return; } - QString code = rx.cap(1); // The 'code' is the first capture of the regexp + QString code = rxMatch.captured(1); // The 'code' is the first capture of the regexp QUrl requestToken = Utility::concatUrlPath(_account->url().toString(), QLatin1String("/index.php/apps/oauth2/api/v1/token")); QNetworkRequest req; |