Skip to content

Commit

Permalink
set stream size for SeekableHttpStream
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and AndyScherzinger committed Feb 27, 2024
1 parent efc987a commit 35a3ac8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/private/Files/Stream/SeekableHttpStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public static function open(callable $callback) {
private $offset = 0;
/** @var int */
private $length = 0;
private int $totalSize = 0;

private function reconnect(int $start) {
$range = $start . '-';
Expand Down Expand Up @@ -124,6 +125,9 @@ private function reconnect(int $start) {

$this->offset = $begin;
$this->length = $length;
if ($start === 0) {
$this->totalSize = $length;
}

return true;
}
Expand Down Expand Up @@ -173,7 +177,9 @@ public function stream_tell() {

public function stream_stat() {
if (is_resource($this->current)) {
return fstat($this->current);
$stat = fstat($this->current);
$stat['size'] = $this->totalSize;
return $stat;
} else {
return false;
}
Expand Down

0 comments on commit 35a3ac8

Please sign in to comment.