Skip to content

Commit

Permalink
Fix OAuthDialog 'code' parse url
Browse files Browse the repository at this point in the history
.. 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
  • Loading branch information
liversedge committed May 31, 2018
1 parent aad4509 commit 9e21ece
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Cloud/OAuthDialog.cpp
Expand Up @@ -242,10 +242,8 @@ OAuthDialog::urlChanged(const QUrl &url)
url.toString().contains("blank.html?code=") || url.toString().contains("blank.html?code=") ||
url.toString().startsWith("http://www.goldencheetah.org/?code=")) { url.toString().startsWith("http://www.goldencheetah.org/?code=")) {


QString code = url.toString().right(url.toString().length()-url.toString().indexOf("code=")-5); QUrlQuery parse(url);

QString code=parse.queryItemValue("code");
// sporttracks insists on passing state
if (code.endsWith("&state=xyzzy")) code = code.mid(0,code.length()-12);


QByteArray data; QByteArray data;
#if QT_VERSION > 0x050000 #if QT_VERSION > 0x050000
Expand Down

0 comments on commit 9e21ece

Please sign in to comment.