aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-08-15 00:08:16 +0200
committerGitHub <noreply@github.com>2024-08-15 00:08:16 +0200
commit44afd9c8b7b21db4169e13fda0cd67fc219d0316 (patch)
treefff5d8a22578e8648cbdfc581c2c187722860f4c
parenta4f4cbe22d1319c9adb81c6f11faa6a59ea7aeda (diff)
downloadnextcloud-server-catchNullHash.tar.gz
nextcloud-server-catchNullHash.zip
fix: lintcatchNullHash
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r--lib/private/Files/Storage/Local.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 41bac73d8bf..cc828b1371f 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -400,20 +400,19 @@ class Local extends \OC\Files\Storage\Common {
return $result;
}
- /** @return string|false */
public function hash($type, $path, $raw = false): string|false {
$sourcePath = $this->getSourcePath($path);
if (!file_exists($sourcePath) || !is_readable($sourcePath)) {
\OC::$server->get(LoggerInterface::class)->error('Source path does not exist or is not readable: ' . $sourcePath, ['app' => 'core']);
return false;
}
-
+
$validAlgorithms = hash_algos();
if (!in_array($type, $validAlgorithms)) {
\OC::$server->get(LoggerInterface::class)->error('Invalid hash algorithm: ' . $type, ['app' => 'core']);
return false;
}
-
+
return hash_file($type, $sourcePath, $raw);
}