diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-17 02:03:18 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-19 19:41:46 +0200 |
commit | 9716b0d7350aa28481a5a9642b74da847c0fa211 (patch) | |
tree | 0fcf5d02e5a39b60bc0aa60bfaa731b3b489ac08 /lib/private/legacy | |
parent | 2e273e477abfc992e2841c3b3b8f19839505a944 (diff) | |
download | nextcloud-server-9716b0d7350aa28481a5a9642b74da847c0fa211.tar.gz nextcloud-server-9716b0d7350aa28481a5a9642b74da847c0fa211.zip |
refactor: Migrate some legacy and core functions to `IFilenameValidator`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/OC_Helper.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 0c913709111..7db60363ff3 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -6,6 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ use bantu\IniGetWrapper\IniGetWrapper; +use OC\Files\FilenameValidator; use OC\Files\Filesystem; use OCP\Files\Mount\IMountPoint; use OCP\IBinaryFinder; @@ -116,6 +117,10 @@ class OC_Helper { * @return void */ public static function copyr($src, $dest) { + if (!file_exists($src)) { + return; + } + if (is_dir($src)) { if (!is_dir($dest)) { mkdir($dest); @@ -126,8 +131,11 @@ class OC_Helper { self::copyr("$src/$file", "$dest/$file"); } } - } elseif (file_exists($src) && !\OC\Files\Filesystem::isFileBlacklisted($src)) { - copy($src, $dest); + } else { + $validator = \OCP\Server::get(FilenameValidator::class); + if (!$validator->isForbidden($src)) { + copy($src, $dest); + } } } |