File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 32
32
#include " qgsvectorlayerexporter.h"
33
33
#include " qgsgeopackagerasterwritertask.h"
34
34
#include " qgstaskmanager.h"
35
+ #include " qgsproviderregistry.h"
35
36
36
37
#include < QAction>
37
38
#include < QMessageBox>
@@ -357,15 +358,16 @@ bool QgsGeoPackageCollectionItem::deleteGeoPackageRasterLayer( const QString &ur
357
358
// Better safe than sorry
358
359
if ( ! uri.isEmpty ( ) )
359
360
{
360
- QStringList pieces ( uri.split ( ' :' ) );
361
- if ( pieces.size () != 3 )
361
+ QVariantMap pieces ( QgsProviderRegistry::instance ()->decodeUri ( QStringLiteral ( " gdal" ), uri ) );
362
+ QString baseUri = pieces[QStringLiteral ( " path" )].toString ();
363
+ QString layerName = pieces[QStringLiteral ( " layerName" )].toString ();
364
+
365
+ if ( baseUri.isEmpty () || layerName.isEmpty () )
362
366
{
363
367
errCause = QStringLiteral ( " Layer URI is malformed: layer <b>%1</b> cannot be deleted!" ).arg ( uri );
364
368
}
365
369
else
366
370
{
367
- QString baseUri = pieces.at ( 1 );
368
- QString layerName = pieces.at ( 2 );
369
371
sqlite3_database_unique_ptr database;
370
372
int status = database.open_v2 ( baseUri, SQLITE_OPEN_READWRITE, nullptr );
371
373
if ( status != SQLITE_OK )
You can’t perform that action at this time.
0 commit comments