Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix auth basic encoding (no auth system)
- Loading branch information
Showing
with
15 additions
and
2 deletions.
-
+2
−2
src/core/qgsdatasourceuri.cpp
-
+13
−0
tests/src/core/testqgsdatasourceuri.cpp
|
@@ -635,7 +635,7 @@ void QgsDataSourceUri::setEncodedUri( const QByteArray &uri ) |
|
|
mAuthConfigId.clear(); |
|
|
|
|
|
QUrl url; |
|
|
url.setQuery( QString::fromLatin1( uri ) ); |
|
|
url.setQuery( QString::fromUtf8( uri ) ); |
|
|
const QUrlQuery query( url ); |
|
|
|
|
|
const auto constQueryItems = query.queryItems( QUrl::ComponentFormattingOption::FullyDecoded ); |
|
@@ -654,7 +654,7 @@ void QgsDataSourceUri::setEncodedUri( const QByteArray &uri ) |
|
|
|
|
|
void QgsDataSourceUri::setEncodedUri( const QString &uri ) |
|
|
{ |
|
|
setEncodedUri( uri.toLatin1() ); |
|
|
setEncodedUri( uri.toUtf8() ); |
|
|
} |
|
|
|
|
|
QString QgsDataSourceUri::quotedTablename() const |
|
|
|
@@ -299,6 +299,19 @@ void TestQgsDataSourceUri::checkAuthParams() |
|
|
QCOMPARE( uri4.param( QStringLiteral( "password" ) ), QStringLiteral( "pa%%word" ) ); |
|
|
QCOMPARE( uri4.password(), QStringLiteral( "pa%%word" ) ); |
|
|
|
|
|
// issue GH #42405 |
|
|
uri4.setEncodedUri( QStringLiteral( "dpiMode=7&url=http://localhost:8000/ows/?MAP%3D/home/bug.qgs&username=username&password=qgis%C3%A8%C3%A9" ) ); |
|
|
QCOMPARE( uri4.param( QStringLiteral( "username" ) ), QStringLiteral( "username" ) ); |
|
|
QCOMPARE( uri4.username(), QStringLiteral( "username" ) ); |
|
|
QCOMPARE( uri4.param( QStringLiteral( "password" ) ), QStringLiteral( "qgisèé" ) ); |
|
|
QCOMPARE( uri4.password(), QStringLiteral( "qgisèé" ) ); |
|
|
|
|
|
uri4.setEncodedUri( QStringLiteral( "dpiMode=7&url=http://localhost:8000/&username=username&password=%1" ).arg( QString( QUrl::toPercentEncoding( QStringLiteral( "😁😂😍" ) ) ) ) ); |
|
|
QCOMPARE( uri4.param( QStringLiteral( "username" ) ), QStringLiteral( "username" ) ); |
|
|
QCOMPARE( uri4.username(), QStringLiteral( "username" ) ); |
|
|
QCOMPARE( uri4.param( QStringLiteral( "password" ) ), QStringLiteral( "😁😂😍" ) ); |
|
|
QCOMPARE( uri4.password(), QStringLiteral( "😁😂😍" ) ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|