Skip to content

Commit 6a281f0

Browse files
committed
fix(files): Use OCP\Util::getForbiddenFileNameChars instead of direct access to system config
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 147426c commit 6a281f0

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

apps/files/lib/Controller/ViewController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
use OCP\AppFramework\Http\TemplateResponse;
5353
use OCP\AppFramework\Services\IInitialState;
5454
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as ResourcesLoadAdditionalScriptsEvent;
55-
use OCP\Constants;
5655
use OCP\EventDispatcher\IEventDispatcher;
5756
use OCP\Files\Folder;
5857
use OCP\Files\IRootFolder;
@@ -253,9 +252,8 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
253252
$this->initialState->provideInitialState('filesSortingConfig', $filesSortingConfig);
254253

255254
// Forbidden file characters
256-
/** @var string[] */
257-
$forbiddenCharacters = $this->config->getSystemValue('forbidden_chars', []);
258-
$this->initialState->provideInitialState('forbiddenCharacters', Constants::FILENAME_INVALID_CHARS . implode('', $forbiddenCharacters));
255+
$forbiddenCharacters = \OCP\Util::getForbiddenFileNameChars();
256+
$this->initialState->provideInitialState('forbiddenCharacters', implode('', $forbiddenCharacters));
259257

260258
$event = new LoadAdditionalScriptsEvent();
261259
$this->eventDispatcher->dispatchTyped($event);

apps/files/tests/Controller/ViewControllerTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ public function testIndexWithRegularBrowser() {
152152
'ownerDisplayName' => 'MyDisplayName',
153153
]);
154154

155-
$this->config
156-
->expects($this->any())
157-
->method('getSystemValue')
158-
->with('forbidden_chars', [])
159-
->willReturn([]);
160155
$this->config
161156
->method('getUserValue')
162157
->willReturnMap([

0 commit comments

Comments
 (0)