diff --git a/lib/Controller/DocumentController.php b/lib/Controller/DocumentController.php index 74cb33fb88..a7cad7d23f 100644 --- a/lib/Controller/DocumentController.php +++ b/lib/Controller/DocumentController.php @@ -400,8 +400,20 @@ public function token(int $fileId, ?string $shareToken = null, ?string $path = n $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) { diff --git a/src/view/Office.vue b/src/view/Office.vue index da844c7856..228123e13e 100644 --- a/src/view/Office.vue +++ b/src/view/Office.vue @@ -332,6 +332,7 @@ export default { revisionHistory: !this.isPublic, closeButton: !Config.get('hideCloseButton') && !this.isEmbedded, startPresentation: Config.get('startPresentation'), + target: data.target, }) this.$set(this.formData, 'action', action) this.$set(this.formData, 'accessToken', data.token)