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 e42b9f7 commit 3b2bac2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/qgsvectorlayerexporter.cpp
Original file line number Diff line number Diff line change
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 3b2bac2

Please sign in to comment.