Skip to content

Commit

Permalink
Merge pull request #38760 from nextcloud/seekable-http-size-25
Browse files Browse the repository at this point in the history
[25] set stream size for SeekableHttpStream
  • Loading branch information
blizzz authored Jun 15, 2023
2 parents 60bb6da + d2d8704 commit 87f4795
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 @@ -78,6 +78,7 @@ public static function open(callable $callback) {
private int $offset = 0;
private int $length = 0;
private bool $needReconnect = false;
private int $totalSize = 0;

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

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

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

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

0 comments on commit 87f4795

Please sign in to comment.