diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Capabilities.php | 21 | ||||
-rw-r--r-- | apps/files/openapi.json | 19 |
2 files changed, 31 insertions, 9 deletions
diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php index 9147e7d9f3a..b024307c25b 100644 --- a/apps/files/lib/Capabilities.php +++ b/apps/files/lib/Capabilities.php @@ -7,28 +7,31 @@ */ namespace OCA\Files; +use OC\Files\FilenameValidator; use OCP\Capabilities\ICapability; -use OCP\IConfig; class Capabilities implements ICapability { - protected IConfig $config; - - public function __construct(IConfig $config) { - $this->config = $config; + public function __construct( + protected FilenameValidator $filenameValidator, + ) { } /** * Return this classes capabilities * - * @return array{files: array{bigfilechunking: bool, blacklisted_files: array<mixed>, forbidden_filename_characters: array<string>}} + * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: array<mixed>, forbidden_filenames: list<string>, forbidden_filename_characters: list<string>, forbidden_filename_extensions: list<string>}} */ - public function getCapabilities() { + public function getCapabilities(): array { return [ 'files' => [ + '$comment' => '"blacklisted_files" is deprecated as of Nextcloud 30, use "forbidden_filenames" instead', + 'blacklisted_files' => $this->filenameValidator->getForbiddenFilenames(), + 'forbidden_filenames' => $this->filenameValidator->getForbiddenFilenames(), + 'forbidden_filename_characters' => $this->filenameValidator->getForbiddenCharacters(), + 'forbidden_filename_extensions' => $this->filenameValidator->getForbiddenExtensions(), + 'bigfilechunking' => true, - 'blacklisted_files' => (array)$this->config->getSystemValue('blacklisted_files', ['.htaccess']), - 'forbidden_filename_characters' => \OCP\Util::getForbiddenFileNameChars(), ], ]; } diff --git a/apps/files/openapi.json b/apps/files/openapi.json index e00674ccc81..7fc6bc3e0b0 100644 --- a/apps/files/openapi.json +++ b/apps/files/openapi.json @@ -29,12 +29,19 @@ "files": { "type": "object", "required": [ + "$comment", "bigfilechunking", "blacklisted_files", + "forbidden_filenames", "forbidden_filename_characters", + "forbidden_filename_extensions", "directEditing" ], "properties": { + "$comment": { + "type": "string", + "nullable": true + }, "bigfilechunking": { "type": "boolean" }, @@ -44,12 +51,24 @@ "type": "object" } }, + "forbidden_filenames": { + "type": "array", + "items": { + "type": "string" + } + }, "forbidden_filename_characters": { "type": "array", "items": { "type": "string" } }, + "forbidden_filename_extensions": { + "type": "array", + "items": { + "type": "string" + } + }, "directEditing": { "type": "object", "required": [ |