From dbeb526bbab64e051958e1194e32903c2420e40d Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Fri, 22 Sep 2023 14:22:04 +0200 Subject: fix(files): disallow illegal characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/lib/Controller/ViewController.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'apps/files/lib/Controller/ViewController.php') 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()); -- cgit v1.2.3