Skip to content

Commit 87f4795

Browse files
authored
Merge pull request #38760 from nextcloud/seekable-http-size-25
[25] set stream size for SeekableHttpStream
2 parents 60bb6da + d2d8704 commit 87f4795

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
@@ -78,6 +78,7 @@ public static function open(callable $callback) {
7878
private int $offset = 0;
7979
private int $length = 0;
8080
private bool $needReconnect = false;
81+
private int $totalSize = 0;
8182

8283
private function reconnect(int $start): bool {
8384
$this->needReconnect = false;
@@ -128,6 +129,9 @@ private function reconnect(int $start): bool {
128129

129130
$this->offset = $begin;
130131
$this->length = $length;
132+
if ($start === 0) {
133+
$this->totalSize = $length;
134+
}
131135

132136
return true;
133137
}
@@ -211,7 +215,9 @@ public function stream_tell() {
211215

212216
public function stream_stat() {
213217
if ($this->getCurrent()) {
214-
return fstat($this->getCurrent());
218+
$stat = fstat($this->getCurrent());
219+
$stat['size'] = $this->totalSize;
220+
return $stat;
215221
} else {
216222
return false;
217223
}

0 commit comments

Comments
 (0)