Merge pull request #5141 from nextcloud/backport/5116/stable29

[stable29] fix: Pass document target through viewer component
This commit is contained in:
Julius Knorr 2025-11-19 20:40:32 +01:00 committed by GitHub
commit f15504abc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -406,8 +406,20 @@ class DocumentController extends Controller {
$this->tokenManager->setGuestName($wopi, $guestName);
$params = [
'urlSrc' => $this->tokenManager->getUrlSrc($file)
];
$targetData = $this->session->get(self::SESSION_FILE_TARGET);
if ($targetData) {
$this->session->remove(self::SESSION_FILE_TARGET);
if ($targetData['fileId'] === $fileId) {
$params['target'] = $targetData['target'];
}
}
return new DataResponse(array_merge(
[ 'urlSrc' => $this->tokenManager->getUrlSrc($file) ],
$params,
$wopi->jsonSerialize(),
));
} catch (Exception $e) {

View file

@ -340,6 +340,7 @@ export default {
readOnly: forceReadOnly || version > 0,
revisionHistory: !this.isPublic,
closeButton: !Config.get('hideCloseButton') && !this.isEmbedded,
target: data.target,
})
this.$set(this.formData, 'action', action)
this.$set(this.formData, 'accessToken', data.token)