Skip to content
Permalink
Browse files

Fix auth basic non-ascii encoding

Fixes #42405
  • Loading branch information
elpaso authored and github-actions committed Mar 24, 2021
1 parent 54329bf commit 63ac0326e3c55dd586bcd29a9f97ea576cc2455f
Showing with 3 additions and 1 deletion.
  1. +1 −1 src/auth/basic/qgsauthbasicmethod.cpp
  2. +2 −0 tests/src/python/test_qgsauthbasicmethod.py
@@ -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;
}
@@ -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)

0 comments on commit 63ac032

Please sign in to comment.