Skip to content

Commit e433a10

Browse files
committedSep 28, 2018
Use decodeUri to make bad layers file parsing more stable
1 parent 0396abf commit e433a10

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed
 

‎src/app/qgshandlebadlayers.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,13 @@ QString QgsHandleBadLayers::filename( int row )
176176

177177
if ( type == QLatin1String( "vector" ) )
178178
{
179-
if ( provider == QLatin1String( "spatialite" ) )
180-
{
181-
QgsDataSourceUri uri( datasource );
182-
return uri.database();
183-
}
184-
else if ( provider == QLatin1String( "ogr" ) )
185-
{
186-
QStringList theURIParts = datasource.split( '|' );
187-
return theURIParts[0];
188-
}
189-
else if ( provider == QLatin1String( "delimitedtext" ) )
190-
{
191-
return QUrl::fromEncoded( datasource.toLatin1() ).toLocalFile();
192-
}
179+
const QVariantMap parts = QgsProviderRegistry::instance()->decodeUri( provider, datasource );
180+
return parts.value( QLatin1String( "path" ) ).toString();
193181
}
194182
else
195183
{
196184
return datasource;
197185
}
198-
199-
return QString();
200186
}
201187

202188
void QgsHandleBadLayers::setFilename( int row, const QString &filename )

0 commit comments

Comments
 (0)
Please sign in to comment.