diff options
-rw-r--r-- | lib/private/Files/Storage/Local.php | 11 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Availability.php | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index eec1c236116..fa239f13ec5 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -400,8 +400,15 @@ class Local extends \OC\Files\Storage\Common { 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 149cbbaa33b..6bd622e1c1b 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -315,6 +315,7 @@ class Availability extends Wrapper { return parent::hash($type, $path, $raw); } catch (StorageNotAvailableException $e) { $this->setUnavailable($e); + return false; } } |