Fix OAuthDialog 'code' parse url

.. the code to parse the redirect url and exract
   the query item 'code' was fragile -- and got
   broken when Strava added a new query item to
   the returned URL.

.. we now use QUrlQuery to extract in a more
   robust and future proof way

Fixes #2879
This commit is contained in:
Mark Liversedge
2018-05-31 21:13:24 +01:00
parent aad45092ae
commit 9e21ececff

View File

@@ -242,10 +242,8 @@ OAuthDialog::urlChanged(const QUrl &url)
url.toString().contains("blank.html?code=") ||
url.toString().startsWith("http://www.goldencheetah.org/?code=")) {
QString code = url.toString().right(url.toString().length()-url.toString().indexOf("code=")-5);
// sporttracks insists on passing state
if (code.endsWith("&state=xyzzy")) code = code.mid(0,code.length()-12);
QUrlQuery parse(url);
QString code=parse.queryItemValue("code");
QByteArray data;
#if QT_VERSION > 0x050000