Skip to content

Commit

Permalink
Use QgsGdalUtils::pathIsCheapToOpen to determine whether it's safe to…
Browse files Browse the repository at this point in the history
… skip the extension only scan for ogr sublayers
  • Loading branch information
nyalldawson committed Jul 23, 2021
1 parent 7716d19 commit a65af60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/core/providers/ogr/qgsogrprovidermetadata.cpp
Expand Up @@ -1132,10 +1132,10 @@ QList<QgsProviderSublayerDetails> QgsOgrProviderMetadata::querySublayers( const
return {};
}

// these extensions are trivial to read, so there's no need to rely on
// if file is trivial to read then there's no need to rely on
// the extension only scan here -- avoiding it always gives us the correct data type
// and sublayer visibility
if ( !QgsGdalUtils::INEXPENSIVE_TO_SCAN_EXTENSIONS.contains( suffix ) )
if ( !QgsGdalUtils::pathIsCheapToOpen( path ) )
{
// if this is a VRT file make sure it is vector VRT
if ( suffix == QLatin1String( "vrt" ) && !QgsGdalUtils::vrtMatchesLayerType( path, QgsMapLayerType::VectorLayer ) )
Expand Down
6 changes: 0 additions & 6 deletions src/core/qgsgdalutils.cpp
Expand Up @@ -48,12 +48,6 @@ const QStringList QgsGdalUtils::SUPPORTED_DB_LAYERS_EXTENSIONS
QStringLiteral( "nc" ),
QStringLiteral( "shp.zip" ) };

const QStringList QgsGdalUtils::INEXPENSIVE_TO_SCAN_EXTENSIONS
{
QStringLiteral( "xlsx" ),
QStringLiteral( "ods" ),
QStringLiteral( "csv" ) };

bool QgsGdalUtils::supportsRasterCreate( GDALDriverH driver )
{
QString driverShortName = GDALGetDriverShortName( driver );
Expand Down

0 comments on commit a65af60

Please sign in to comment.