mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 13:55:47 +03:00
Ensure blacklisted e2ee files get deleted
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
b333310ffe
commit
efcd23eb06
1 changed files with 26 additions and 0 deletions
|
@ -1387,6 +1387,32 @@ void Folder::removeLocalE2eFiles()
|
||||||
slotTerminateSync();
|
slotTerminateSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto &e2eFilePath : qAsConst(e2eFoldersToBlacklist)) {
|
||||||
|
if (!_journal.deleteFileRecord(e2eFilePath, true)) {
|
||||||
|
qCWarning(lcFolder) << "Failed to delete file record from local DB" << e2eFilePath
|
||||||
|
<< "it might have already been deleted.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
qCDebug(lcFolder) << "Removing local copy of" << e2eFilePath;
|
||||||
|
|
||||||
|
const auto fullPath = QString(path() + e2eFilePath);
|
||||||
|
const QFileInfo pathInfo(fullPath);
|
||||||
|
|
||||||
|
if (pathInfo.isDir() && pathInfo.exists()) {
|
||||||
|
QDir dir(fullPath);
|
||||||
|
if (!dir.removeRecursively()) {
|
||||||
|
qCWarning(lcFolder) << "Unable to remove directory and contents at:" << fullPath;
|
||||||
|
}
|
||||||
|
} else if (pathInfo.exists()) {
|
||||||
|
if (!QFile::remove(fullPath)) {
|
||||||
|
qCWarning(lcFolder) << "Unable to delete:" << fullPath;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCWarning(lcFolder) << "Unable to delete:" << fullPath << "as it does not exist!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto &path : qAsConst(e2eFoldersToBlacklist)) {
|
for (const auto &path : qAsConst(e2eFoldersToBlacklist)) {
|
||||||
_journal.schedulePathForRemoteDiscovery(path);
|
_journal.schedulePathForRemoteDiscovery(path);
|
||||||
schedulePathForLocalDiscovery(path);
|
schedulePathForLocalDiscovery(path);
|
||||||
|
|
Loading…
Reference in a new issue