Skip to content
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
11 changes: 6 additions & 5 deletions apps/dav/lib/Upload/AssemblyStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public function stream_open($path, $mode, $options, &$opened_path) {
return strnatcmp($a->getName(), $b->getName());
});
$this->nodes = array_values($nodes);
if (count($this->nodes) > 0) {
$this->currentStream = $this->getStream($this->nodes[0]);
}
$this->size = array_reduce($this->nodes, function ($size, IFile $file) {
return $size + $file->getSize();
}, 0);
Expand Down Expand Up @@ -104,7 +101,11 @@ public function stream_tell() {
*/
public function stream_read($count) {
if (is_null($this->currentStream)) {
return '';
if ($this->currentNode < count($this->nodes)) {
$this->currentStream = $this->getStream($this->nodes[$this->currentNode]);
} else {
return '';
}
}

do {
Expand Down Expand Up @@ -182,7 +183,7 @@ public function stream_flush() {
* @return bool
*/
public function stream_eof() {
return $this->pos >= $this->size || $this->currentStream === null;
return $this->pos >= $this->size || ($this->currentNode >= count($this->nodes) && $this->currentNode === null);
}

/**
Expand Down