diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index a23879607c2df..3c241dbc4bc3b 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -439,8 +439,15 @@ public function fopen($path, $mode) { return $result; } - public function hash($type, $path, $raw = false) { - return hash_file($type, $this->getSourcePath($path), $raw); + public function hash($type, $path, $raw = false): string|false { + /** @var string|false|null */ + $hash = hash_file($type, $this->getSourcePath($path), $raw); + + if ($hash === null) { + return false; + } + + return $hash; } public function free_space($path) { diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 693d943f0dc28..bab43977b608f 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -334,6 +334,7 @@ public function hash($type, $path, $raw = false) { return parent::hash($type, $path, $raw); } catch (StorageNotAvailableException $e) { $this->setUnavailable($e); + return false; } }