Skip to content
Permalink
Browse files
Fix newly created spatialite databases can have no extension
  • Loading branch information
nyalldawson authored and nirvn committed Nov 6, 2021
1 parent 55e0526 commit 70c2ef19172c07fbcfbdfe5e4b27fbfe89099cdf
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/app/qgsnewspatialitelayerdialog.cpp
@@ -258,15 +258,15 @@ void QgsNewSpatialiteLayerDialog::selectionChanged()

bool QgsNewSpatialiteLayerDialog::createDb()
{
const QString dbPath = QFileDialog::getSaveFileName( this, tr( "New SpatiaLite Database File" ),
QDir::homePath(),
tr( "SpatiaLite" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db)", nullptr, QFileDialog::DontConfirmOverwrite );
QString dbPath = QFileDialog::getSaveFileName( this, tr( "New SpatiaLite Database File" ),
QDir::homePath(),
tr( "SpatiaLite" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db)", nullptr, QFileDialog::DontConfirmOverwrite );

if ( dbPath.isEmpty() )
return false;

QgsFileUtils::ensureFileNameHasExtension( dbPath, QStringList() << QStringLiteral( ".sqlite" ) << QLatin1String( ".db" ) << QLatin1String( ".sqlite3" )
<< QLatin1String( ".db3" ) << QLatin1String( ".s3db" ) );
dbPath = QgsFileUtils::ensureFileNameHasExtension( dbPath, QStringList() << QStringLiteral( "sqlite" ) << QStringLiteral( "db" ) << QStringLiteral( "sqlite3" )
<< QStringLiteral( "db3" ) << QStringLiteral( "s3db" ) );
QFile newDb( dbPath );
if ( newDb.exists() )
{

0 comments on commit 70c2ef1

Please sign in to comment.