From bd8a27ee241e006b32e5fb2efad45602f86eaa44 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 17 Nov 2022 09:29:42 -0700 Subject: [PATCH] Collabora's extra share needs to use restricted fstab from original share, not full fstab --- api/src/Vfs/Sharing.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/src/Vfs/Sharing.php b/api/src/Vfs/Sharing.php index 9339c0ca31..d0292ac81b 100644 --- a/api/src/Vfs/Sharing.php +++ b/api/src/Vfs/Sharing.php @@ -16,6 +16,7 @@ namespace EGroupware\Api\Vfs; use EGroupware\Api; use EGroupware\Api\Json\Response; use EGroupware\Api\Vfs; +use EGroupware\Collabora\Wopi; use EGroupware\Filemanager\Sharing\AnonymousList; use EGroupware\Filemanager\Sharing\Ui; use EGroupware\Filemanager\Sharing\Ui as ShareUi; @@ -439,12 +440,15 @@ class Sharing extends \EGroupware\Api\Sharing if (($exists = ($stat = Vfs::stat($path)) && Vfs::check_access($path, Vfs::READABLE, $stat))) { // Not sure why stat puts a / on the end of files, but remove it - if(substr($stat['url'],-1) == '/' && !Vfs::is_dir($stat['url'])) + if(substr($stat['url'], -1) == '/' && !Vfs::is_dir($stat['url'])) { - $stat['url'] = substr($stat['url'],0,strlen($stat['url'])-1); + $stat['url'] = substr($stat['url'], 0, strlen($stat['url']) - 1); } // Make sure we get the correct path if sharing from a share - if(isset($GLOBALS['egw']->sharing) && array_key_exists(static::get_token(), $GLOBALS['egw']->sharing) && $exists) + if(isset($GLOBALS['egw']->sharing) && array_key_exists(static::get_token(), $GLOBALS['egw']->sharing) && $exists + // Not for Collabora, it's working with share fstab and can't access full URL + && $mode !== Wopi::WOPI_WRITABLE + ) { $path = $stat['url']; }