Import: don't assume an empty file is a text file

Since in any case, the empty file has nothing to import and it's admitted by
SQLite as a valid database, it's better to revert to the previous behaviour,
where an empty file dropped or opened by the file manager was treated as a DB
and indeed worked.

The behaviour was changed by cfa4dee3be

See issue #2636
This commit is contained in:
mgrojo
2021-03-20 14:16:23 +01:00
parent 78edc8f991
commit 93a5c2d0ca

View File

@@ -65,7 +65,7 @@ bool isTextOnlyFile(const QString& fileName)
QFile file(fileName);
if (file.open(QFile::ReadOnly)) {
QByteArray data = file.read(512);
return isTextOnly(data);
return !data.isEmpty() && isTextOnly(data);
} else {
return false;
}