Skip to content

Commit

Permalink
Fix auth encoding issue
Browse files Browse the repository at this point in the history
Fixes: #10564
  • Loading branch information
TheOneRing committed Mar 3, 2023
1 parent a68dbad commit 4609315
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/10564
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix encoding issue with basic authentication

In 3.0 we introduced an encoding issue for basic authentication.

https://github.com/owncloud/client/issues/10564
4 changes: 2 additions & 2 deletions src/gui/newwizard/jobs/checkbasicauthjobfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ CoreJob *CheckBasicAuthJobFactory::startJob(const QUrl &url, QObject *parent)

req.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual);

QString authorizationHeader = QStringLiteral("Basic %1").arg(QString::fromLocal8Bit(QStringLiteral("%1:%2").arg(_username, _password).toLocal8Bit().toBase64()));
req.setRawHeader("Authorization", authorizationHeader.toLocal8Bit());
QString authorizationHeader = QStringLiteral("Basic %1").arg(QString::fromUtf8(QStringLiteral("%1:%2").arg(_username, _password).toUtf8().toBase64()));
req.setRawHeader("Authorization", authorizationHeader.toUtf8());

auto *job = new CoreJob(nam()->sendCustomRequest(req, "PROPFIND"), parent);

Expand Down
2 changes: 1 addition & 1 deletion src/libsync/networkjobs/fetchuserinfojobfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace OCC {

FetchUserInfoJobFactory FetchUserInfoJobFactory::fromBasicAuthCredentials(QNetworkAccessManager *nam, const QString &username, const QString &password)
{
QString authorizationHeader = QStringLiteral("Basic %1").arg(QString::fromLocal8Bit(QStringLiteral("%1:%2").arg(username, password).toLocal8Bit().toBase64()));
QString authorizationHeader = QStringLiteral("Basic %1").arg(QString::fromUtf8(QStringLiteral("%1:%2").arg(username, password).toUtf8().toBase64()));
return { nam, authorizationHeader };
}

Expand Down

0 comments on commit 4609315

Please sign in to comment.