Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
  • Loading branch information
solracsf committed Aug 14, 2024
1 parent a4f4cbe commit 44afd9c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,20 +400,19 @@ public function fopen($path, $mode) {
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);
}

Expand Down

0 comments on commit 44afd9c

Please sign in to comment.