aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/Controller
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-12-16 15:53:12 -0800
committerChristopher Ng <chrng8@gmail.com>2025-01-15 15:50:43 -0800
commit0eb39d7b9c92712a8083841c227f92dad3d0c86a (patch)
tree530bbd2d70c129e53d4011bbb1730ddb7435fa91 /apps/files_sharing/lib/Controller
parent4d78de497f085dc09614fe4d7f0db1bb46c6397f (diff)
downloadnextcloud-server-0eb39d7b9c92712a8083841c227f92dad3d0c86a.tar.gz
nextcloud-server-0eb39d7b9c92712a8083841c227f92dad3d0c86a.zip
feat(sharing): Respect admin custom tokens setting
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/files_sharing/lib/Controller')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php3
1 files changed, 3 insertions, 0 deletions
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'));
}