Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix auth basic non-ascii encoding
Fixes #42405
  • Loading branch information
elpaso authored and nyalldawson committed Mar 24, 2021
1 parent 7f0d2f6 commit 04cc0d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/auth/basic/qgsauthbasicmethod.cpp
Expand Up @@ -80,7 +80,7 @@ bool QgsAuthBasicMethod::updateNetworkRequest( QNetworkRequest &request, const Q

if ( !username.isEmpty() )
{
request.setRawHeader( "Authorization", "Basic " + QStringLiteral( "%1:%2" ).arg( username, password ).toLatin1().toBase64() );
request.setRawHeader( "Authorization", "Basic " + QStringLiteral( "%1:%2" ).arg( username, password ).toUtf8().toBase64() );
}
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/src/python/test_qgsauthbasicmethod.py
Expand Up @@ -89,6 +89,8 @@ def testHeaderEncoding(self):
for creds in (
('username', 'password'),
('username', r'pa%%word'),
('username', r'èé'),
('username', r'😁😂😍'),
):
self.assertEqual(self._get_decoded_credentials(*creds), creds)

Expand Down

0 comments on commit 04cc0d2

Please sign in to comment.