Skip to content

Commit

Permalink
Use decodeUri instead of string parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 31, 2018
1 parent 50cf8b9 commit 08c2002
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/qgsvectorlayerexporter.cpp
Expand Up @@ -126,7 +126,8 @@ QgsVectorLayerExporter::QgsVectorLayerExporter( const QString &uri,
// that will be filled by ogr with unique values.

// HACK sorry
if ( sinkFlags.testFlag( QgsFeatureSink::SinkFlag::RegeneratePrimaryKey ) && uri.endsWith( QLatin1String( ".gpkg" ) ) )
const QString path = QgsProviderRegistry::instance()->decodeUri( QStringLiteral( "ogr" ), uri ).value( QStringLiteral( "path" ) );
if ( sinkFlags.testFlag( QgsFeatureSink::SinkFlag::RegeneratePrimaryKey ) && path.endsWith( QLatin1String( ".gpkg" ) ) )
{
QString fidName = options.value( QStringLiteral( "FID" ), QStringLiteral( "FID" ) ).toString();
int fidIdx = vectorProvider->fields().lookupField( fidName );
Expand Down

0 comments on commit 08c2002

Please sign in to comment.