Skip to content

Commit

Permalink
Add Raster Layer: do not include credentials in layer name
Browse files Browse the repository at this point in the history
Fixes #60292
rouault authored and nyalldawson committed Jan 31, 2025
1 parent 1cf9734 commit c42f86f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/app/layers/qgsapplayerhandling.cpp
Original file line number Diff line number Diff line change
@@ -1134,8 +1134,6 @@ QList<QgsMapLayer *> QgsAppLayerHandling::addGdalRasterLayers( const QStringList

if ( QgsRasterLayer::isValidRasterFileName( uri, errMsg ) )
{
QFileInfo myFileInfo( uri );

// set the layer name to the file base name unless provided explicitly
QString layerName;
const QVariantMap uriDetails = QgsProviderRegistry::instance()->decodeUri( QStringLiteral( "gdal" ), uri );
@@ -1145,7 +1143,7 @@ QList<QgsMapLayer *> QgsAppLayerHandling::addGdalRasterLayers( const QStringList
}
else
{
layerName = QgsProviderUtils::suggestLayerNameFromFilePath( uri );
layerName = QgsProviderUtils::suggestLayerNameFromFilePath( uriDetails[QStringLiteral( "path" )].toString() );
}

// try to create the layer
@@ -1163,7 +1161,7 @@ QList<QgsMapLayer *> QgsAppLayerHandling::addGdalRasterLayers( const QStringList
//only allow one copy of a ai grid file to be loaded at a
//time to prevent the user selecting all adfs in 1 dir which
//actually represent 1 coverage,

const QFileInfo myFileInfo( uriDetails[QStringLiteral( "path" )].toString() );
if ( myFileInfo.fileName().endsWith( QLatin1String( ".adf" ), Qt::CaseInsensitive ) )
{
break;

0 comments on commit c42f86f

Please sign in to comment.