Skip to content

Commit

Permalink
do not restore connection if URL is empty
Browse files Browse the repository at this point in the history
We might have some dangling referer settings which are never deleted because they are now part of the http-headers.

As safety, we do not restore connections which have empty URLs.

fixes #53321
  • Loading branch information
3nids authored and nyalldawson committed Oct 25, 2024
1 parent 7cb947b commit ef68425
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/settings/qgssettingsregistrycore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ void QgsSettingsRegistryCore::migrateOldSettings()
continue;
for ( const QString &connection : connections )
{
if ( settings.value( QStringLiteral( "%1/url" ).arg( connection ) ).toString().isEmpty() )
continue;

QgsOwsConnection::settingsUrl->copyValueFromKey( QStringLiteral( "qgis/connections-%1/%2/url" ), {service.toLower(), connection}, true );
QgsOwsConnection::settingsVersion->copyValueFromKey( QStringLiteral( "qgis/connections-%1/%2/version" ), {service.toLower(), connection}, true );
QgsOwsConnection::settingsIgnoreGetMapURI->copyValueFromKey( QStringLiteral( "qgis/connections-%1/%2/ignoreGetMapURI" ), {service.toLower(), connection}, true );
Expand Down Expand Up @@ -296,6 +299,9 @@ void QgsSettingsRegistryCore::migrateOldSettings()
const QStringList connections = settings.childGroups();
for ( const QString &connection : connections )
{
if ( settings.value( QStringLiteral( "%1/url" ).arg( connection ) ).toString().isEmpty() )
continue;

QgsVectorTileProviderConnection::settingsUrl->copyValueFromKey( QStringLiteral( "qgis/connections-vector-tile/%1/url" ), {connection}, true );
QgsVectorTileProviderConnection::settingsZmin->copyValueFromKey( QStringLiteral( "qgis/connections-vector-tile/%1/zmin" ), {connection}, true );
QgsVectorTileProviderConnection::settingsZmax->copyValueFromKey( QStringLiteral( "qgis/connections-vector-tile/%1/zmax" ), {connection}, true );
Expand All @@ -320,6 +326,9 @@ void QgsSettingsRegistryCore::migrateOldSettings()
const QStringList connections = settings.childGroups();
for ( const QString &connection : connections )
{
if ( settings.value( QStringLiteral( "%1/url" ).arg( connection ) ).toString().isEmpty() )
continue;

QgsXyzConnectionSettings::settingsUrl->copyValueFromKey( QStringLiteral( "qgis/connections-xyz/%1/url" ), {connection}, true );
QgsXyzConnectionSettings::settingsZmin->copyValueFromKey( QStringLiteral( "qgis/connections-xyz/%1/zmin" ), {connection}, true );
QgsXyzConnectionSettings::settingsZmax->copyValueFromKey( QStringLiteral( "qgis/connections-xyz/%1/zmax" ), {connection}, true );
Expand Down

0 comments on commit ef68425

Please sign in to comment.