aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2023-09-22 14:22:04 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-10-04 11:12:44 +0200
commitdbeb526bbab64e051958e1194e32903c2420e40d (patch)
tree3e976dec8699518e0f5db13051430aedd0225807 /apps/files/lib
parent4756807f2e72b1dcd8ba11e038bcd5e01d41044a (diff)
downloadnextcloud-server-dbeb526bbab64e051958e1194e32903c2420e40d.tar.gz
nextcloud-server-dbeb526bbab64e051958e1194e32903c2420e40d.zip
fix(files): disallow illegal characters
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/Controller/ViewController.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 8764e1fabd6..d4a75b514eb 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -52,6 +52,7 @@ use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as ResourcesLoadAdditionalScriptsEvent;
+use OCP\Constants;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
@@ -246,6 +247,11 @@ class ViewController extends Controller {
$filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true);
$this->initialState->provideInitialState('filesSortingConfig', $filesSortingConfig);
+ // Forbidden file characters
+ /** @var string[] */
+ $forbiddenCharacters = $this->config->getSystemValue('forbidden_chars', []);
+ $this->initialState->provideInitialState('forbiddenCharacters', Constants::FILENAME_INVALID_CHARS . implode('', $forbiddenCharacters));
+
$event = new LoadAdditionalScriptsEvent();
$this->eventDispatcher->dispatchTyped($event);
$this->eventDispatcher->dispatchTyped(new ResourcesLoadAdditionalScriptsEvent());