Skip to content

Commit

Permalink
addVectorLayerPrivate(): fix loading of WFS layers
Browse files Browse the repository at this point in the history
Fixes #39847. master only (related to 1132494)
  • Loading branch information
rouault authored and nyalldawson committed Nov 7, 2020
1 parent c1df39f commit 7d012ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -12983,7 +12983,8 @@ QgsVectorLayer *QgisApp::addVectorLayerPrivate( const QString &vectorLayerPath,
// run layer path through QgsPathResolver so that all inbuilt paths and other localised paths are correctly expanded
uriElements[ QStringLiteral( "path" ) ] = QgsPathResolver().readPath( uriElements.value( QStringLiteral( "path" ) ).toString() );
}
const QString updatedUri = QgsProviderRegistry::instance()->encodeUri( providerKey, uriElements );
// Not all providers implement decodeUri(), so use original vectorLayerPath if uriElements is empty
const QString updatedUri = uriElements.isEmpty() ? vectorLayerPath : QgsProviderRegistry::instance()->encodeUri( providerKey, uriElements );
QgsVectorLayer *layer = new QgsVectorLayer( updatedUri, baseName, providerKey, options );

if ( authok && layer->isValid() )
Expand Down

0 comments on commit 7d012ee

Please sign in to comment.