From: Kevin Ottens Date: Tue, 30 Jun 2020 08:24:40 +0000 (+0200) Subject: Also check on mangled names when cleaning up the journal X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~125^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0f21b625ab540b84593ab49b4666d896e198aa24;p=nextcloud-desktop.git Also check on mangled names when cleaning up the journal Otherwise, after a first sync all the mangled entries would be removed from the journal. On second sync it would be fine because we'd then have seen the unmangled names because of the local files. Unfortunately that'd mean reuploading them for nothing or trying to mkdir again on the server for nothing... with a chance of using differently mangled names (although I didn't spot it, I can't exclude it never happened). This also led to weirdly getting stuck during sync when there was more than one sync point. Signed-off-by: Kevin Ottens --- diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index ff4e352fe..43b0b045c 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -1133,7 +1133,7 @@ bool SyncJournalDb::postSyncCleanup(const QSet &filepathsToKeep, } SqlQuery query(_db); - query.prepare("SELECT phash, path FROM metadata order by path"); + query.prepare("SELECT phash, path, e2eMangledName FROM metadata order by path"); if (!query.exec()) { return false; @@ -1142,11 +1142,12 @@ bool SyncJournalDb::postSyncCleanup(const QSet &filepathsToKeep, QByteArrayList superfluousItems; while (query.next()) { - const QString file = query.baValue(1); - bool keep = filepathsToKeep.contains(file); + const auto file = QString(query.baValue(1)); + const auto mangledPath = QString(query.baValue(2)); + bool keep = filepathsToKeep.contains(file) || filepathsToKeep.contains(mangledPath); if (!keep) { foreach (const QString &prefix, prefixesToKeep) { - if (file.startsWith(prefix)) { + if (file.startsWith(prefix) || mangledPath.startsWith(prefix)) { keep = true; break; }