diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-10 16:59:26 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-11 13:31:54 +0200 |
commit | a229723b8c65183f8cb7b62f24f7b9c41a2b622b (patch) | |
tree | df4a12b49dc500f877a58603f1c47d65d7bfe814 /lib | |
parent | b09347ae536da3640d5cb8cff4254325f6e90926 (diff) | |
download | nextcloud-server-a229723b8c65183f8cb7b62f24f7b9c41a2b622b.tar.gz nextcloud-server-a229723b8c65183f8cb7b62f24f7b9c41a2b622b.zip |
feat: Add new forbidden filename options to Capabilities
Allow clients to access the new filename validation options
and make frontend name validation possible.
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Kate <26026535+provokateurin@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/OCS/BaseResponse.php | 4 | ||||
-rw-r--r-- | lib/private/Template/JSConfigHelper.php | 9 | ||||
-rw-r--r-- | lib/private/TemplateLayout.php | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/AppFramework/OCS/BaseResponse.php b/lib/private/AppFramework/OCS/BaseResponse.php index 2e685de856b..d367574a179 100644 --- a/lib/private/AppFramework/OCS/BaseResponse.php +++ b/lib/private/AppFramework/OCS/BaseResponse.php @@ -133,7 +133,9 @@ abstract class BaseResponse extends Response { $v = []; } - if (\is_array($v)) { + if ($k === '$comment') { + $writer->writeComment($v); + } elseif (\is_array($v)) { $writer->startElement($k); $this->toXML($v, $writer); $writer->endElement(); diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index a41e99ae8c4..963c158a793 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -10,6 +10,7 @@ namespace OC\Template; use bantu\IniGetWrapper\IniGetWrapper; use OC\Authentication\Token\IProvider; use OC\CapabilitiesManager; +use OC\Files\FilenameValidator; use OC\Share\Share; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; @@ -51,6 +52,7 @@ class JSConfigHelper { protected CapabilitiesManager $capabilitiesManager, protected IInitialStateService $initialStateService, protected IProvider $tokenProvider, + protected FilenameValidator $filenameValidator, ) { } @@ -132,9 +134,12 @@ class JSConfigHelper { $capabilities = $this->capabilitiesManager->getCapabilities(false, true); $config = [ - 'auto_logout' => $this->config->getSystemValue('auto_logout', false), + /** @deprecated 30.0.0 - use files capabilities instead */ 'blacklist_files_regex' => FileInfo::BLACKLIST_FILES_REGEX, - 'forbidden_filename_characters' => Util::getForbiddenFileNameChars(), + /** @deprecated 30.0.0 - use files capabilities instead */ + 'forbidden_filename_characters' => $this->filenameValidator->getForbiddenCharacters(), + + 'auto_logout' => $this->config->getSystemValue('auto_logout', false), 'loglevel' => $this->config->getSystemValue('loglevel_frontend', $this->config->getSystemValue('loglevel', ILogger::WARN) ), diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 2f6b0209153..7b33f88d4db 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -9,6 +9,7 @@ namespace OC; use bantu\IniGetWrapper\IniGetWrapper; use OC\Authentication\Token\IProvider; +use OC\Files\FilenameValidator; use OC\Search\SearchQuery; use OC\Template\CSSResourceLocator; use OC\Template\JSConfigHelper; @@ -228,6 +229,7 @@ class TemplateLayout extends \OC_Template { \OC::$server->get(CapabilitiesManager::class), \OCP\Server::get(IInitialStateService::class), \OCP\Server::get(IProvider::class), + \OCP\Server::get(FilenameValidator::class), ); $config = $jsConfigHelper->getConfig(); if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) { |