Skip to content

Commit

Permalink
add robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
ianturton committed Oct 7, 2020
1 parent d97d11f commit a775957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -3026,7 +3026,8 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
{
// rewrite the URL if the one in the capabilities document is incorrect
// strip every thing after the ? from the base url
const QString base = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) )[0];
const QList parts = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) );
const QString base = parts.isEmpty() ? mSettings.mBaseUrl : parts.first();
// and strip everything before the `rest` element (at least for GeoServer)
const int index = url.length() - url.lastIndexOf( QStringLiteral( "rest" ) ) + 1; // +1 for the /
url = base + url.right( index );
Expand Down Expand Up @@ -3054,7 +3055,6 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
else if ( !getFeatureInfoUrl().isNull() )
{
// KVP
QgsDebugMsg( QStringLiteral( "KVP ignore GetFeatureURL %1" ).arg( mSettings.mIgnoreGetFeatureInfoUrl ) );
QUrl url( mSettings.mIgnoreGetFeatureInfoUrl ? mSettings.mBaseUrl : getFeatureInfoUrl() );
QUrlQuery query( url );

Expand Down

0 comments on commit a775957

Please sign in to comment.