mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Don't wipe db if check fails while disk space is low #5357
An experimental fix for the issue, merged because it's low risk and makes testing easier.
This commit is contained in:
parent
bec67455c1
commit
d8c479ab1e
1 changed files with 8 additions and 0 deletions
|
@ -97,6 +97,14 @@ bool SqlDatabase::openOrCreateReadWrite( const QString& filename )
|
|||
}
|
||||
|
||||
if( !checkDb() ) {
|
||||
// When disk space is low, checking the db may fail even though it's fine.
|
||||
qint64 freeSpace = Utility::freeDiskSpace(filename);
|
||||
if (freeSpace < 1000000) {
|
||||
qDebug() << "Consistency check failed, disk space is low, aborting" << freeSpace;
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
||||
qDebug() << "Consistency check failed, removing broken db" << filename;
|
||||
close();
|
||||
QFile::remove(filename);
|
||||
|
|
Loading…
Reference in a new issue