From e4e0767a863ecf5f3a64e1028cf93eacd0d1a476 Mon Sep 17 00:00:00 2001 From: hopleus Date: Mon, 19 Feb 2024 16:28:44 +0300 Subject: [PATCH 1/2] Fixed remote redirect URL for federation shared files Signed-off-by: hopleus --- lib/Service/FederationService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/FederationService.php b/lib/Service/FederationService.php index 2e78a1c5f..7a0cddc95 100644 --- a/lib/Service/FederationService.php +++ b/lib/Service/FederationService.php @@ -139,7 +139,7 @@ public function getRemoteRedirectURL(File $item, $direct = null) { } else { $wopi = $this->tokenManager->getRemoteTokenFromDirect($item, $direct->getUid()); } - $url = $remote . 'index.php/apps/officeonline/remote?shareToken=' . $item->getStorage()->getToken() . + $url = $remote . '/apps/officeonline/remote?shareToken=' . $item->getStorage()->getToken() . '&remoteServer=' . $wopi->getServerHost() . '&remoteServerToken=' . $wopi->getToken(); if ($item->getInternalPath() !== '') { From 6148b2197ac782ff814a24efb013d3b5909aed35 Mon Sep 17 00:00:00 2001 From: hopleus Date: Thu, 29 Feb 2024 14:17:08 +0300 Subject: [PATCH 2/2] Fixed remote redirect URL for federation shared files (Refactoring) Signed-off-by: hopleus --- lib/Service/FederationService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Service/FederationService.php b/lib/Service/FederationService.php index 7a0cddc95..be9d64bd2 100644 --- a/lib/Service/FederationService.php +++ b/lib/Service/FederationService.php @@ -139,7 +139,8 @@ public function getRemoteRedirectURL(File $item, $direct = null) { } else { $wopi = $this->tokenManager->getRemoteTokenFromDirect($item, $direct->getUid()); } - $url = $remote . '/apps/officeonline/remote?shareToken=' . $item->getStorage()->getToken() . + + $url = rtrim($remote, '/') . '/index.php/apps/officeonline/remote?shareToken=' . $item->getStorage()->getToken() . '&remoteServer=' . $wopi->getServerHost() . '&remoteServerToken=' . $wopi->getToken(); if ($item->getInternalPath() !== '') {