Merge pull request #6547 from nextcloud/bugfix/files-lock-incorrect-readonly-set

Bugfix. Files-lock. Incorrect readonly state for TokenLock.
This commit is contained in:
allexzander 2024-03-18 13:53:40 +01:00 committed by GitHub
commit 82da32e3d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -1371,7 +1371,12 @@ void PropagateDownloadFile::updateMetadata(bool isConflict)
handleRecallFile(fn, propagator()->localPath(), *propagator()->_journal);
}
if (_item->_locked == SyncFileItem::LockStatus::LockedItem && (_item->_lockOwnerType != SyncFileItem::LockOwnerType::UserLock || _item->_lockOwnerId != propagator()->account()->davUser())) {
const auto isLockOwnedByCurrentUser = _item->_lockOwnerId == propagator()->account()->davUser();
const auto isUserLockOwnedByCurrentUser = (_item->_lockOwnerType == SyncFileItem::LockOwnerType::UserLock && isLockOwnedByCurrentUser);
const auto isTokenLockOwnedByCurrentUser = (_item->_lockOwnerType == SyncFileItem::LockOwnerType::TokenLock && isLockOwnedByCurrentUser);
if (_item->_locked == SyncFileItem::LockStatus::LockedItem && !isUserLockOwnedByCurrentUser && !isTokenLockOwnedByCurrentUser) {
qCDebug(lcPropagateDownload()) << fn << "file is locked: making it read only";
FileSystem::setFileReadOnly(fn, true);
} else {