Skip to content

Commit

Permalink
lock token should be sent via webdav only for token lock type
Browse files Browse the repository at this point in the history
to be able to modify a locked file using token lock, we must sent it
with webdav requests

this must not be sent if the file is locked but the lock type is not a
token lock

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien authored and backportbot[bot] committed Sep 26, 2024
1 parent 406faec commit 2069c97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/libsync/propagateuploadng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ void PropagateUploadFileNG::finishUpload()

const auto fileSize = _fileToUpload._size;
headers[QByteArrayLiteral("OC-Total-Length")] = QByteArray::number(fileSize);
if (_item->_locked == SyncFileItem::LockStatus::LockedItem) {
if (_item->_lockOwnerType == SyncFileItem::LockOwnerType::TokenLock &&
_item->_locked == SyncFileItem::LockStatus::LockedItem) {
headers[QByteArrayLiteral("If")] = (QLatin1String("<") + propagator()->account()->davUrl().toString() + _fileToUpload._file + "> (<opaquelocktoken:" + _item->_lockToken.toUtf8() + ">)").toUtf8();
}

Expand Down
3 changes: 2 additions & 1 deletion src/libsync/propagateuploadv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ void PropagateUploadFileV1::startNextChunk()

QString path = _fileToUpload._file;

if (_item->_locked == SyncFileItem::LockStatus::LockedItem) {
if (_item->_lockOwnerType == SyncFileItem::LockOwnerType::TokenLock &&
_item->_locked == SyncFileItem::LockStatus::LockedItem) {
headers[QByteArrayLiteral("If")] = (QLatin1String("<") + propagator()->account()->davUrl().toString() + _fileToUpload._file + "> (<opaquelocktoken:" + _item->_lockToken.toUtf8() + ">)").toUtf8();
}

Expand Down

0 comments on commit 2069c97

Please sign in to comment.