Browse files

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
  • Loading branch information...
liversedge committed May 31, 2018
1 parent aad4509 commit 9e21ececff7175e3dd9a2e920e8e8931b11668c8
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/Cloud/OAuthDialog.cpp
@@ -242,10 +242,8 @@ OAuthDialog::urlChanged(const QUrl &url)
url.toString().contains("blank.html?code=") ||
url.toString().startsWith("")) {
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

0 comments on commit 9e21ece

Please sign in to comment.