mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-05-09 05:34:07 +02:00
File watcher: Pin state attribute changes are valid notifications
Previously they would be discarded since the file's mtime or size hadn't changed.
This commit is contained in:
parent
83a818678f
commit
d8873c18a1
src
@ -53,6 +53,7 @@ public:
|
||||
QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); }
|
||||
|
||||
bool isDirectory() const { return _type == ItemTypeDirectory; }
|
||||
bool isFile() const { return _type == ItemTypeFile || _type == ItemTypeVirtualFileDehydration; }
|
||||
bool isVirtualFile() const { return _type == ItemTypeVirtualFile || _type == ItemTypeVirtualFileDownload; }
|
||||
|
||||
QByteArray _path;
|
||||
|
@ -560,11 +560,23 @@ void Folder::slotWatchedPathChanged(const QString &path)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check that the mtime actually changed.
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
if (spurious) {
|
||||
qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath;
|
||||
return; // probably a spurious notification
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user