Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable24] fix: Let wopi middleware also handle asset fetching #3405

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading