Skip to content

Commit

Permalink
QgsRasterFileWriter::driverForExtension(): make sure querying the tif…
Browse files Browse the repository at this point in the history
…/tiff extension returns the GTiff driver

Not strictly necessary since has been adressed on GDAL side per OSGeo/gdal#11037
but might be prudent for future similar situations.

Fixes #59112
  • Loading branch information
rouault authored and nyalldawson committed Oct 18, 2024
1 parent 5471ff2 commit cc04caf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/raster/qgsrasterfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,16 @@ QString QgsRasterFileWriter::driverForExtension( const QString &extension )
if ( ext.startsWith( '.' ) )
ext.remove( 0, 1 );

if ( ext.compare( QLatin1String( "tif" ), Qt::CaseInsensitive ) == 0 ||
ext.compare( QLatin1String( "tiff" ), Qt::CaseInsensitive ) == 0 )
{
// Be robust to GDAL drivers potentially recognizing the tif/tiff extensions
// but being registered before the GTiff one.
// Cf https://github.com/qgis/QGIS/issues/59112
if ( GDALGetDriverByName( "GTiff" ) )
return "GTiff";
}

GDALAllRegister();
int const drvCount = GDALGetDriverCount();

Expand Down

0 comments on commit cc04caf

Please sign in to comment.