Skip to content
Permalink
Browse files
Fix retrieval of vsiSuffix in gdal/ogr decodeUri methods
  • Loading branch information
nyalldawson committed Jul 12, 2021
1 parent 065566b commit c94d4b7e8d987feca7647da1b7cf3f81fa058654
@@ -332,15 +332,13 @@ QVariantMap QgsGdalProviderBase::decodeGdalUri( const QString &uri )
if ( path.startsWith( vsiPrefix, Qt::CaseInsensitive ) )
{
path = path.mid( vsiPrefix.count() );
if ( vsiPrefix == QLatin1String( "/vsizip/" ) )

const QRegularExpression vsiRegex( QStringLiteral( "(?:\\.zip|\\.tar|\\.gz|\\.tar\\.gz|\\.tgz)([^|]+)" ) );
QRegularExpressionMatch match = vsiRegex.match( path );
if ( match.hasMatch() )
{
const QRegularExpression vsiRegex( QStringLiteral( "(?:\\.zip|\\.tar|\\.gz|\\.tar\\.gz|\\.tgz)([^|]*)" ) );
QRegularExpressionMatch match = vsiRegex.match( path );
if ( match.hasMatch() )
{
vsiSuffix = match.captured( 1 );
path = path.remove( match.capturedStart( 1 ), match.capturedLength( 1 ) );
}
vsiSuffix = match.captured( 1 );
path = path.remove( match.capturedStart( 1 ), match.capturedLength( 1 ) );
}
}
else
@@ -79,15 +79,13 @@ QVariantMap QgsOgrProviderMetadata::decodeUri( const QString &uri ) const
if ( path.startsWith( vsiPrefix, Qt::CaseInsensitive ) )
{
path = path.mid( vsiPrefix.count() );
if ( vsiPrefix == QLatin1String( "/vsizip/" ) )

const QRegularExpression vsiRegex( QStringLiteral( "(?:\\.zip|\\.tar|\\.gz|\\.tar\\.gz|\\.tgz)([^|]+)" ) );
QRegularExpressionMatch match = vsiRegex.match( path );
if ( match.hasMatch() )
{
const QRegularExpression vsiRegex( QStringLiteral( "(?:\\.zip|\\.tar|\\.gz|\\.tar\\.gz|\\.tgz)([^|]*)" ) );
QRegularExpressionMatch match = vsiRegex.match( path );
if ( match.hasMatch() )
{
vsiSuffix = match.captured( 1 );
path = path.remove( match.capturedStart( 1 ), match.capturedLength( 1 ) );
}
vsiSuffix = match.captured( 1 );
path = path.remove( match.capturedStart( 1 ), match.capturedLength( 1 ) );
}
}
else

0 comments on commit c94d4b7

Please sign in to comment.