From cb99a5795dd84a3dcd6a260c7ebeb614a093dd0f Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Wed, 23 Nov 2022 12:43:57 +0100 Subject: [PATCH] Update cache when file size === 0 The conditions were false when $result === 0. $results here contains the number of written bits. The correct way of checking for operation success is to check if $result === false Signed-off-by: Louis Chemineau --- lib/private/Files/View.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index c78517d09ef07..3cd7504025322 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1189,13 +1189,13 @@ private function basicOperation($operation, $path, $hooks = [], $extraParam = nu throw $e; } - if ($result && in_array('delete', $hooks)) { + if ($result !== false && in_array('delete', $hooks)) { $this->removeUpdate($storage, $internalPath); } - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { + if ($result !== false && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { $this->writeUpdate($storage, $internalPath); } - if ($result && in_array('touch', $hooks)) { + if ($result !== false && in_array('touch', $hooks)) { $this->writeUpdate($storage, $internalPath, $extraParam); }