Skip to content

Commit

Permalink
Bugfix. Files-lock. Inorrect readonly state for TokenLock.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Mar 15, 2024
1 parent 462c35a commit 025ad5b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Check warning on line 1379 in src/libsync/propagatedownload.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/propagatedownload.cpp:1379:5 [bugprone-branch-clone]

if with identical then and else branches
qCDebug(lcPropagateDownload()) << fn << "file is locked: making it read only";
FileSystem::setFileReadOnly(fn, true);
} else {
Expand Down

0 comments on commit 025ad5b

Please sign in to comment.