mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix: Also expose forbidden filename character in the capabilities
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
27642d3e6d
commit
1017f4f34a
4 changed files with 15 additions and 4 deletions
|
|
@ -39,13 +39,14 @@ class Capabilities implements ICapability {
|
|||
/**
|
||||
* 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' => \OCP\Util::getForbiddenFileNameChars(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
"required": [
|
||||
"bigfilechunking",
|
||||
"blacklisted_files",
|
||||
"forbidden_filename_characters",
|
||||
"directEditing"
|
||||
],
|
||||
"properties": {
|
||||
|
|
@ -43,6 +44,12 @@
|
|||
"type": "object"
|
||||
}
|
||||
},
|
||||
"forbidden_filename_characters": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"directEditing": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -1962,6 +1962,8 @@ $CONFIG = [
|
|||
/**
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ use OC\AppScriptDependency;
|
|||
use OC\AppScriptSort;
|
||||
use OCP\Share\IManager;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* This class provides different helper functions to make the life of a developer easier
|
||||
|
|
@ -533,9 +534,9 @@ class Util {
|
|||
}
|
||||
|
||||
// Get admin defined invalid characters
|
||||
$additionalChars = \OC::$server->getConfig()->getSystemValue('forbidden_chars', []);
|
||||
$additionalChars = \OCP\Server::get(IConfig::class)->getSystemValue('forbidden_chars', []);
|
||||
if (!is_array($additionalChars)) {
|
||||
\OC::$server->getLogger()->error('Invalid system config value for "forbidden_chars" is ignored.');
|
||||
\OCP\Server::get(LoggerInterface::class)->error('Invalid system config value for "forbidden_chars" is ignored.');
|
||||
$additionalChars = [];
|
||||
}
|
||||
return array_merge($invalidChars, $additionalChars);
|
||||
|
|
|
|||
Loading…
Reference in a new issue