diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-15 16:29:44 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-16 12:49:10 +0200 |
commit | f4ede27cdbbb4f55bb963130295a28a89a833d94 (patch) | |
tree | fefcca04d1fff7e897e13da0ac3fcc4bef70a3d4 /lib | |
parent | 69341e4306259430533cf66fd0a76688c7c8e6ab (diff) | |
download | nextcloud-server-f4ede27cdbbb4f55bb963130295a28a89a833d94.tar.gz nextcloud-server-f4ede27cdbbb4f55bb963130295a28a89a833d94.zip |
refactor: Remove deprecated `Util` function for filename validation to `FilenameValidator`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/legacy/OC_Util.php | 29 | ||||
-rw-r--r-- | lib/public/Util.php | 34 |
2 files changed, 0 insertions, 63 deletions
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index b7836e86d7b..d8045e8343d 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -1037,35 +1037,6 @@ class OC_Util { } /** - * Returns whether the given file name is valid - * - * @param string $file file name to check - * @return bool true if the file name is valid, false otherwise - * @deprecated use \OC\Files\View::verifyPath() - */ - public static function isValidFileName($file) { - $trimmed = trim($file); - if ($trimmed === '') { - return false; - } - if (\OC\Files\Filesystem::isIgnoredDir($trimmed)) { - return false; - } - - // detect part files - if (preg_match('/' . \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX . '/', $trimmed) !== 0) { - return false; - } - - foreach (\OCP\Util::getForbiddenFileNameChars() as $char) { - if (str_contains($trimmed, $char)) { - return false; - } - } - return true; - } - - /** * Check whether the instance needs to perform an upgrade, * either when the core version is higher or any app requires * an upgrade. diff --git a/lib/public/Util.php b/lib/public/Util.php index 4cee9addf10..17794810c1a 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -18,7 +18,6 @@ use OCP\L10N\IFactory; use OCP\Mail\IMailer; 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 @@ -489,39 +488,6 @@ class Util { } /** - * Get a list of characters forbidden in file names - * @return string[] - * @since 29.0.0 - */ - public static function getForbiddenFileNameChars(): array { - // Get always forbidden characters - $invalidChars = str_split(\OCP\Constants::FILENAME_INVALID_CHARS); - if ($invalidChars === false) { - $invalidChars = []; - } - - // Get admin defined invalid characters - $additionalChars = \OCP\Server::get(IConfig::class)->getSystemValue('forbidden_chars', []); - if (!is_array($additionalChars)) { - \OCP\Server::get(LoggerInterface::class)->error('Invalid system config value for "forbidden_chars" is ignored.'); - $additionalChars = []; - } - return array_merge($invalidChars, $additionalChars); - } - - /** - * Returns whether the given file name is valid - * @param string $file file name to check - * @return bool true if the file name is valid, false otherwise - * @deprecated 8.1.0 use OCP\Files\Storage\IStorage::verifyPath() - * @since 7.0.0 - * @suppress PhanDeprecatedFunction - */ - public static function isValidFileName($file) { - return \OC_Util::isValidFileName($file); - } - - /** * Compare two strings to provide a natural sort * @param string $a first string to compare * @param string $b second string to compare |