Skip to content

Commit 3546b00

Browse files
authored
Merge pull request #5415 from nextcloud/backport/5412/stable33
[stable33] fix: Properly check for lock wopi operations
2 parents cff51b9 + d39ce98 commit 3546b00

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/Controller/WopiController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,10 @@ public function postFile(string $fileId, string $access_token): JSONResponse {
668668
return new JSONResponse([], Http::STATUS_FORBIDDEN);
669669
}
670670

671+
if (!$wopi->getCanwrite()) {
672+
return new JSONResponse([], Http::STATUS_FORBIDDEN);
673+
}
674+
671675
switch ($wopiOverride) {
672676
case 'LOCK':
673677
return $this->lock($wopi, $wopiLock);
@@ -686,10 +690,6 @@ public function postFile(string $fileId, string $access_token): JSONResponse {
686690

687691
$isRenameFile = ($this->request->getHeader('X-WOPI-Override') === 'RENAME_FILE');
688692

689-
if (!$wopi->getCanwrite()) {
690-
return new JSONResponse([], Http::STATUS_FORBIDDEN);
691-
}
692-
693693
// Unless the editor is empty (public link) we modify the files as the current editor
694694
$editor = $wopi->getEditorUid();
695695
$isPublic = $editor === null && !$wopi->isRemoteToken();

0 commit comments

Comments
 (0)