From 0eb39d7b9c92712a8083841c227f92dad3d0c86a Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Mon, 16 Dec 2024 15:53:12 -0800 Subject: feat(sharing): Respect admin custom tokens setting Signed-off-by: Christopher Ng --- apps/files_sharing/lib/Controller/ShareAPIController.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apps/files_sharing/lib/Controller') diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index b00c97f0dd3..f0b89ab5d47 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -1331,6 +1331,9 @@ class ShareAPIController extends OCSController { } if ($token !== null) { + if (!$this->shareManager->allowCustomTokens()) { + throw new OCSForbiddenException($this->l->t('Custom share link tokens have been disabled by the administrator')); + } if (!$this->validateToken($token)) { throw new OCSBadRequestException($this->l->t('Tokens must contain at least 1 character and may only contain letters, numbers, or a hyphen')); } -- cgit v1.2.3