Skip to content

Commit 5088b97

Browse files
committed
set stream size for SeekableHttpStream
Signed-off-by: Robin Appelman <[email protected]>
1 parent 399d0d3 commit 5088b97

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/private/Files/Stream/SeekableHttpStream.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static function open(callable $callback) {
7979
private $offset = 0;
8080
/** @var int */
8181
private $length = 0;
82+
private int $totalSize = 0;
8283

8384
private function reconnect(int $start) {
8485
$range = $start . '-';
@@ -124,6 +125,9 @@ private function reconnect(int $start) {
124125

125126
$this->offset = $begin;
126127
$this->length = $length;
128+
if ($start === 0) {
129+
$this->totalSize = $length;
130+
}
127131

128132
return true;
129133
}
@@ -173,7 +177,9 @@ public function stream_tell() {
173177

174178
public function stream_stat() {
175179
if (is_resource($this->current)) {
176-
return fstat($this->current);
180+
$stat = fstat($this->current);
181+
$stat['size'] = $this->totalSize;
182+
return $stat;
177183
} else {
178184
return false;
179185
}

0 commit comments

Comments
 (0)