Skip to content

Commit

Permalink
Apply suggestions from code review in View.php
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Gaussorgues <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc and Altahrim committed Sep 5, 2023
1 parent 168b07d commit 6b2580d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ public function readfile($path) {
}
$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);
Expand Down Expand Up @@ -482,8 +482,8 @@ public function readfilePart($path, $from, $to) {
$len = $chunkSize;
}
echo fread($handle, $len);
$this->checkConnectionStatus();
flush();
$this->checkConnectionStatus();
}
return ftell($handle) - $from;
}
Expand All @@ -496,7 +496,7 @@ public function readfilePart($path, $from, $to) {

private function checkConnectionStatus(): void {
$connectionStatus = \connection_status();
if ($connectionStatus !== 0) {
if ($connectionStatus !== CONNECTION_NORMAL) {
throw new ConnectionLostException("Connection lost. Status: $connectionStatus");
}
}
Expand Down

0 comments on commit 6b2580d

Please sign in to comment.