Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[25] set stream size for SeekableHttpStream #38760

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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