Skip to content

Commit

Permalink
Merge pull request #3406 from nextcloud/backport/3403/stable23
Browse files Browse the repository at this point in the history
[stable23] fix: Let wopi middleware also handle asset fetching
  • Loading branch information
max-nextcloud authored Jan 11, 2024
2 parents 87d8492 + 1541254 commit 6bf3eb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Middleware/WOPIMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
namespace OCA\Richdocuments\Middleware;

use OCA\Richdocuments\AppInfo\Application;
use OCA\Richdocuments\Controller\AssetsController;
use OCA\Richdocuments\Controller\WopiController;
use OCA\Richdocuments\Db\WopiMapper;
use OCA\Richdocuments\Helper;
Expand Down Expand Up @@ -61,7 +62,11 @@ public function __construct(IConfig $config, IRequest $request, WopiMapper $wopi
public function beforeController($controller, $methodName) {
parent::beforeController($controller, $methodName);

if ($controller instanceof WopiController && !$this->isWOPIAllowed()) {
// Check controllers that are only supposed to be called by Collabora directly
// FIXME: This can be moved to a PHP attribute in the future
$isRestrictedController = $controller instanceof WopiController
|| ($controller instanceof AssetsController && $methodName === 'get');
if ($isRestrictedController && !$this->isWOPIAllowed()) {
throw new NotPermittedException();
}

Expand Down

0 comments on commit 6bf3eb9

Please sign in to comment.