Skip to content

Commit 4faadc0

Browse files
committed
Properly end iterating over the file once the target has been reached
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent ce082dd commit 4faadc0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/private/Files/View.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,12 @@ public function readfilePart($path, $from, $to) {
456456
// forward file handle via chunked fread because fseek seem to have failed
457457

458458
$end = $from + 1;
459-
while (!feof($handle) && ftell($handle) < $end) {
459+
while (!feof($handle) && ftell($handle) < $end && ftell($handle) !== $from) {
460460
$len = $from - ftell($handle);
461461
if ($len > $chunkSize) {
462462
$len = $chunkSize;
463463
}
464+
464465
$result = fread($handle, $len);
465466

466467
if ($result === false) {

0 commit comments

Comments
 (0)