Skip to content

Commit

Permalink
fix: Also expose forbidden filename character in the capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Feb 23, 2024
1 parent 2a1f3ed commit 83b7e48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/files/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public function __construct(IConfig $config) {
/**
* Return this classes capabilities
*
* @return array{files: array{bigfilechunking: bool, blacklisted_files: array<mixed>}}
* @return array{files: array{bigfilechunking: bool, blacklisted_files: array<mixed>, forbidden_filename_characters: array<string>}}
*/
public function getCapabilities() {
return [
'files' => [
'bigfilechunking' => true,
'blacklisted_files' => (array)$this->config->getSystemValue('blacklisted_files', ['.htaccess'])
'blacklisted_files' => (array)$this->config->getSystemValue('blacklisted_files', ['.htaccess']),
'forbidden_filename_characters' => \OC_Util::getForbiddenFileNameChars(),
],
];
}
Expand Down
7 changes: 7 additions & 0 deletions apps/files/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"required": [
"bigfilechunking",
"blacklisted_files",
"forbidden_filename_characters",
"directEditing"
],
"properties": {
Expand All @@ -43,6 +44,12 @@
"type": "object"
}
},
"forbidden_filename_characters": {
"type": "array",
"items": {
"type": "string"
}
},
"directEditing": {
"type": "object",
"required": [
Expand Down
2 changes: 2 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,8 @@
/**
* Blacklist characters from being used in filenames. This is useful if you
* have a filesystem or OS which does not support certain characters like windows.
*
* The '/' and '\' characters are always forbidden.
*
* Example for windows systems: ``array('?', '<', '>', ':', '*', '|', '"', chr(0), "\n", "\r")``
* see https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
Expand Down

0 comments on commit 83b7e48

Please sign in to comment.