Skip to content

Commit

Permalink
Use decodeUri to make bad layers file parsing more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 28, 2018
1 parent 0396abf commit e433a10
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/app/qgshandlebadlayers.cpp
Expand Up @@ -176,27 +176,13 @@ QString QgsHandleBadLayers::filename( int row )

if ( type == QLatin1String( "vector" ) )
{
if ( provider == QLatin1String( "spatialite" ) )
{
QgsDataSourceUri uri( datasource );
return uri.database();
}
else if ( provider == QLatin1String( "ogr" ) )
{
QStringList theURIParts = datasource.split( '|' );
return theURIParts[0];
}
else if ( provider == QLatin1String( "delimitedtext" ) )
{
return QUrl::fromEncoded( datasource.toLatin1() ).toLocalFile();
}
const QVariantMap parts = QgsProviderRegistry::instance()->decodeUri( provider, datasource );
return parts.value( QLatin1String( "path" ) ).toString();
}
else
{
return datasource;
}

return QString();
}

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

0 comments on commit e433a10

Please sign in to comment.