Skip to content

Commit d446980

Browse files
committed
Fix auth encoding issue
Fixes: #10564
1 parent a68dbad commit d446980

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

changelog/unreleased/10564

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bugfix: Fix encoding issue with basic authentication
2+
3+
In 3.0 we introduced an encoding issue for basic authentication.
4+
5+
https://github.com/owncloud/client/issues/10564

src/gui/newwizard/jobs/checkbasicauthjobfactory.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ CoreJob *CheckBasicAuthJobFactory::startJob(const QUrl &url, QObject *parent)
3131

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

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

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

src/libsync/networkjobs/fetchuserinfojobfactory.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace OCC {
2626

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

0 commit comments

Comments
 (0)