Skip to content

Commit b2fe8c8

Browse files
committed
[FIX] deliver current revision in WOPI
1 parent 8daf438 commit b2fe8c8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Services/WOPI/classes/Embed/EmbeddedApplication.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class EmbeddedApplication
4040

4141
public function __construct(
4242
protected ResourceIdentification $identification,
43-
protected ?Action $action,
43+
protected Action $action,
4444
protected ResourceStakeholder $stakeholder,
4545
protected URI $back_target,
4646
protected bool $inline = false,
@@ -55,9 +55,7 @@ public function __construct(
5555
'resource_id' => $this->identification->serialize(),
5656
'user_id' => $DIC->user()->getId(),
5757
'stakeholder' => $this->stakeholder::class,
58-
'editable' => $edit ?? ($this->action === null
59-
? false
60-
: $this->action->getName() === ActionTarget::EDIT->value)
58+
'editable' => $edit ?? ($this->action->getName() === ActionTarget::EDIT->value)
6159
];
6260
$this->token = $data_signer->sign($payload, 'wopi', new \DateTimeImmutable("now + $this->ttl seconds"));
6361
$this->ilias_base_url = $ilias_base_url ?? new URI(ILIAS_HTTP_PATH);

Services/WOPI/classes/Handler/RequestHandler.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ public function handleRequest(): void
128128
$this->http->close();
129129
}
130130
$resource = $this->irss->manage()->getResource($resource_id);
131-
$current_revision = $resource->getCurrentRevisionIncludingDraft();
131+
if ($this->editable) {
132+
$current_revision = $resource->getCurrentRevisionIncludingDraft();
133+
} else {
134+
$current_revision = $resource->getCurrentRevision();
135+
}
132136

133137
$method_override = $this->http->request()->getHeader(self::HEADER_X_WOPI_OVERRIDE)[0] ?? null;
134138
$is_file_convertion = (bool) ($this->http->request()->getHeader(

0 commit comments

Comments
 (0)