Skip to content
Permalink
Browse files

addVectorLayerPrivate(): fix loading of WFS layers

Fixes #39847. master only (related to 1132494)
  • Loading branch information
rouault authored and nyalldawson committed Nov 7, 2020
1 parent c1df39f commit 7d012ee783732dac9a6d0f6367d8da7994ff3f33
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/app/qgisapp.cpp
@@ -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() )

0 comments on commit 7d012ee

Please sign in to comment.
You can’t perform that action at this time.