From 35a3ac81b45e4f4d7549c9b699774627c1bf320d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 12 Jun 2023 16:28:34 +0200 Subject: [PATCH] set stream size for SeekableHttpStream Signed-off-by: Robin Appelman --- lib/private/Files/Stream/SeekableHttpStream.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index 820a681bd0748..ef2485dc1efad 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -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 . '-'; @@ -124,6 +125,9 @@ private function reconnect(int $start) { $this->offset = $begin; $this->length = $length; + if ($start === 0) { + $this->totalSize = $length; + } return true; } @@ -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; }