diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-06-13 15:50:43 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-07-28 16:54:13 +0200 |
commit | 3cfb4cbf94be0f4da1fd7e84b0e37aeb623d9690 (patch) | |
tree | 1e9c7abda29b44b97915aac89164a5aecb4ce3b6 /apps/files_sharing | |
parent | 2ee659e54787c938e57787261442ad4037270322 (diff) | |
download | nextcloud-server-3cfb4cbf94be0f4da1fd7e84b0e37aeb623d9690.tar.gz nextcloud-server-3cfb4cbf94be0f4da1fd7e84b0e37aeb623d9690.zip |
Block download when needed on direct download endpoint
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 451d6b6557a..ae039520c5b 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -165,6 +165,7 @@ class Application extends App implements IBootstrap { 'file.beforeGetDirect', function (GenericEvent $event) use ($userSession, $rootFolder) { $pathsToCheck = [$event->getArgument('path')]; + $event->setArgument('run', true); // Check only for user/group shares. Don't restrict e.g. share links if ($userSession && $userSession->isLoggedIn()) { @@ -173,6 +174,7 @@ class Application extends App implements IBootstrap { $rootFolder->getUserFolder($uid) ); if (!$viewOnlyHandler->check($pathsToCheck)) { + $event->setArgument('run', false); $event->setArgument('errorMessage', 'Access to this resource or one of its sub-items has been denied.'); } } |