From c7591f63320258ecbac72d10b2b79efe5694214c Mon Sep 17 00:00:00 2001 From: alex-z Date: Mon, 29 Apr 2024 21:57:02 +0200 Subject: [PATCH] Bugfix. Files lock. Check lock owner type for setting readonly based on server capabilities (NC27/28 compatibility issue). Signed-off-by: alex-z --- src/libsync/syncengine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 4a9f656a4712b..8f8dcecec31ca 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -390,7 +390,11 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item) } if (item->_type == CSyncEnums::ItemTypeVirtualFile) { - if (item->_locked == SyncFileItem::LockStatus::LockedItem && (item->_lockOwnerType != SyncFileItem::LockOwnerType::TokenLock || item->_lockOwnerId != account()->davUser())) { + const auto lockOwnerTypeToSkipReadonly = _account->capabilities().filesLockTypeAvailable() + ? SyncFileItem::LockOwnerType::TokenLock + : SyncFileItem::LockOwnerType::UserLock; + if (item->_locked == SyncFileItem::LockStatus::LockedItem + && (item->_lockOwnerType != lockOwnerTypeToSkipReadonly || item->_lockOwnerId != account()->davUser())) { qCDebug(lcEngine()) << filePath << "file is locked: making it read only"; FileSystem::setFileReadOnly(filePath, true); } else {