Skip to content

Commit 6b2580d

Browse files
come-ncAltahrim
andcommitted
Apply suggestions from code review in View.php
Co-authored-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 168b07d commit 6b2580d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/private/Files/View.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,11 @@ public function readfile($path) {
426426
}
427427
$handle = $this->fopen($path, 'rb');
428428
if ($handle) {
429-
$chunkSize = 524288; // 512 kB chunks
429+
$chunkSize = 524288; // 512 kiB chunks
430430
while (!feof($handle)) {
431431
echo fread($handle, $chunkSize);
432-
$this->checkConnectionStatus();
433432
flush();
433+
$this->checkConnectionStatus();
434434
}
435435
fclose($handle);
436436
return $this->filesize($path);
@@ -482,8 +482,8 @@ public function readfilePart($path, $from, $to) {
482482
$len = $chunkSize;
483483
}
484484
echo fread($handle, $len);
485-
$this->checkConnectionStatus();
486485
flush();
486+
$this->checkConnectionStatus();
487487
}
488488
return ftell($handle) - $from;
489489
}
@@ -496,7 +496,7 @@ public function readfilePart($path, $from, $to) {
496496

497497
private function checkConnectionStatus(): void {
498498
$connectionStatus = \connection_status();
499-
if ($connectionStatus !== 0) {
499+
if ($connectionStatus !== CONNECTION_NORMAL) {
500500
throw new ConnectionLostException("Connection lost. Status: $connectionStatus");
501501
}
502502
}

0 commit comments

Comments
 (0)