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
  • Loading branch information
rouault authored and nyalldawson committed Feb 2, 2025
1 parent c3ea118 commit a47eb97
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
Expand Up @@ -1128,8 +1128,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 );
Expand All @@ -1139,7 +1137,7 @@ QList<QgsMapLayer *> QgsAppLayerHandling::addGdalRasterLayers( const QStringList
}
else
{
layerName = QgsProviderUtils::suggestLayerNameFromFilePath( uri );
layerName = QgsProviderUtils::suggestLayerNameFromFilePath( uriDetails[QStringLiteral( "path" )].toString() );
}

// try to create the layer
Expand All @@ -1157,7 +1155,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;
Expand Down

0 comments on commit a47eb97

Please sign in to comment.