From 4296ebffeec02e86dfc51ee0840fcf9a8cc27a39 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 25 Feb 2020 11:40:51 +0100 Subject: [PATCH] OAuth: make sure to encode the '+' in query string The server understands '+' as a space. Issue #7762 --- changelog/unreleased/7762 | 7 +++++++ src/gui/creds/oauth.cpp | 1 + 2 files changed, 8 insertions(+) create mode 100644 changelog/unreleased/7762 diff --git a/changelog/unreleased/7762 b/changelog/unreleased/7762 new file mode 100644 index 0000000000..ea681cff38 --- /dev/null +++ b/changelog/unreleased/7762 @@ -0,0 +1,7 @@ +Bugfix: Fixed OAuth2 login of user with `+` + +Make sure that the `+` in the user name is properly encoded in the URL +opened by the browser when doing an OAuth2 authentication. + +https://github.com/owncloud/client/issues/7762 + diff --git a/src/gui/creds/oauth.cpp b/src/gui/creds/oauth.cpp index 91bdf190b1..3069a1304d 100644 --- a/src/gui/creds/oauth.cpp +++ b/src/gui/creds/oauth.cpp @@ -171,6 +171,7 @@ QUrl OAuth::authorisationLink() const if (!_expectedUser.isNull()) query.addQueryItem("user", _expectedUser); QUrl url = Utility::concatUrlPath(_account->url(), QLatin1String("/index.php/apps/oauth2/authorize"), query); + url.setQuery(url.query(QUrl::FullyEncoded).replace('+', QLatin1String("%2B"))); // Issue #7762 return url; }