Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2019-12-16 18:33:41 +0300
committerKevin Ottens <kevin.ottens@nextcloud.com>2020-12-15 12:59:05 +0300
commitedb51abdfd9ba4a9c95c48d54b280007d3a26509 (patch)
tree967004c39062877900eb6f0789259285c6232f3c /src/gui/folder.cpp
parent3317e354f257cd63caa0e551d11dc2aa8c779f4f (diff)
Don't ignore file sync notification after an unlock
For a usual file sync event we check for actual changes in the local file, after an unlock the local file might be unchanged so we need to sync it anyhow. Fixes: owncloud/enterprise#3609
Diffstat (limited to 'src/gui/folder.cpp')
-rw-r--r--src/gui/folder.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index b77abe387..e513bce40 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -536,7 +536,7 @@ int Folder::slotWipeErrorBlacklist()
return _journal.wipeErrorBlacklist();
}
-void Folder::slotWatchedPathChanged(const QString &path)
+void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
{
if (!path.startsWith(this->path())) {
qCDebug(lcFolder) << "Changed path is not contained in folder, ignoring:" << path;
@@ -567,27 +567,29 @@ void Folder::slotWatchedPathChanged(const QString &path)
}
#endif
- // Check that the mtime/size actually changed or there was
- // an attribute change (pin state) that caused the notification
- bool spurious = false;
+
SyncJournalFileRecord record;
- if (_journal.getFileRecord(relativePathBytes, &record)
- && record.isValid()
- && !FileSystem::fileChanged(path, record._fileSize, record._modtime)) {
- spurious = true;
-
- if (auto pinState = _vfs->pinState(relativePath.toString())) {
- if (*pinState == PinState::AlwaysLocal && record.isVirtualFile())
- spurious = false;
- if (*pinState == PinState::OnlineOnly && record.isFile())
- spurious = false;
+ _journal.getFileRecord(relativePathBytes, &record);
+ if (reason != ChangeReason::UnLock) {
+ // Check that the mtime/size actually changed or there was
+ // an attribute change (pin state) that caused the notification
+ bool spurious = false;
+ if (record.isValid()
+ && !FileSystem::fileChanged(path, record._fileSize, record._modtime)) {
+ spurious = true;
+
+ if (auto pinState = _vfs->pinState(relativePath.toString())) {
+ if (*pinState == PinState::AlwaysLocal && record.isVirtualFile())
+ spurious = false;
+ if (*pinState == PinState::OnlineOnly && record.isFile())
+ spurious = false;
+ }
+ }
+ if (spurious) {
+ qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath;
+ return; // probably a spurious notification
}
}
- if (spurious) {
- qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath;
- return; // probably a spurious notification
- }
-
warnOnNewExcludedItem(record, relativePath);
emit watchedFileChangedExternally(path);
@@ -1219,7 +1221,7 @@ void Folder::registerFolderWatcher()
_folderWatcher.reset(new FolderWatcher(this));
connect(_folderWatcher.data(), &FolderWatcher::pathChanged,
- this, &Folder::slotWatchedPathChanged);
+ this, [this](const QString &path) { slotWatchedPathChanged(path, Folder::ChangeReason::Other); });
connect(_folderWatcher.data(), &FolderWatcher::lostChanges,
this, &Folder::slotNextSyncFullLocalDiscovery);
connect(_folderWatcher.data(), &FolderWatcher::becameUnreliable,