Skip to content

Commit

Permalink
Fix newly created spatialite databases can have no extension
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 5, 2021
1 parent c99065f commit 83b92e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/qgsnewspatialitelayerdialog.cpp
Expand Up @@ -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() )
{
Expand Down

0 comments on commit 83b92e9

Please sign in to comment.