fix(Filesystem): use FilenameValidator for Filesystem::isFileBlacklisted

This fixes the issue that some methods will not allow uploading files
because they still require the deprecated config option to be used.
So instead we need to use the validator introduced in v30.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-09-02 18:59:33 +02:00 committed by backportbot[bot]
parent 347f10b64b
commit 6860d92bf4

View file

@ -29,8 +29,7 @@ class Filesystem {
private static ?CappedMemoryCache $normalizedPathCache = null;
/** @var string[]|null */
private static ?array $blacklist = null;
private static ?FilenameValidator $validator = null;
/**
* classname which used for hooks handling
@ -431,16 +430,16 @@ class Filesystem {
/**
* @param string $filename
* @return bool
*
* @deprecated 30.0.0 - use \OC\Files\FilenameValidator::isForbidden
*/
public static function isFileBlacklisted($filename) {
$filename = self::normalizePath($filename);
if (self::$blacklist === null) {
self::$blacklist = \OC::$server->getConfig()->getSystemValue('blacklisted_files', ['.htaccess']);
if (self::$validator === null) {
self::$validator = \OCP\Server::get(FilenameValidator::class);
}
$filename = strtolower(basename($filename));
return in_array($filename, self::$blacklist);
$filename = self::normalizePath($filename);
return self::$validator->isForbidden($filename);
}
/**