From 342cb33f714fccf0a404560fd43d0893763f1132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <91878298+come-nc@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:31:00 +0200 Subject: [PATCH] Apply suggestions from code review in View.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Gaussorgues Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Côme Chilliet --- lib/private/Files/View.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index cd35aa31a08..0cf5e24616a 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -428,11 +428,11 @@ class View { } $handle = $this->fopen($path, 'rb'); if ($handle) { - $chunkSize = 524288; // 512 kB chunks + $chunkSize = 524288; // 512 kiB chunks while (!feof($handle)) { echo fread($handle, $chunkSize); - $this->checkConnectionStatus(); flush(); + $this->checkConnectionStatus(); } fclose($handle); return $this->filesize($path); @@ -484,8 +484,8 @@ class View { $len = $chunkSize; } echo fread($handle, $len); - $this->checkConnectionStatus(); flush(); + $this->checkConnectionStatus(); } return ftell($handle) - $from; } @@ -498,7 +498,7 @@ class View { private function checkConnectionStatus(): void { $connectionStatus = \connection_status(); - if ($connectionStatus !== 0) { + if ($connectionStatus !== CONNECTION_NORMAL) { throw new ConnectionLostException("Connection lost. Status: $connectionStatus"); } }