summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-10-23 16:17:49 +0200
committerGitHub <noreply@github.com>2018-10-23 16:17:49 +0200
commit869df2ee7abd15d9e33c62d4c1bb5c692f2cbf2d (patch)
treef0212b45a12878124411f98119cc872efda9b11d /apps
parent9b092fd4bde43b3e01a3a53d0b0c02b08cd22712 (diff)
parent2f518b6ac880cff556e3e52a84a4aa048eeaecbe (diff)
downloadnextcloud-server-869df2ee7abd15d9e33c62d4c1bb5c692f2cbf2d.tar.gz
nextcloud-server-869df2ee7abd15d9e33c62d4c1bb5c692f2cbf2d.zip
Merge pull request #11980 from nextcloud/assemblly-stream-lazy
lazy open first source stream in assemblystream
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Upload/AssemblyStream.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php
index 24417851f2f..95e324f0468 100644
--- a/apps/dav/lib/Upload/AssemblyStream.php
+++ b/apps/dav/lib/Upload/AssemblyStream.php
@@ -76,9 +76,6 @@ class AssemblyStream implements \Icewind\Streams\File {
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);
@@ -107,7 +104,11 @@ class AssemblyStream implements \Icewind\Streams\File {
*/
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 {
@@ -191,7 +192,7 @@ class AssemblyStream implements \Icewind\Streams\File {
* @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);
}
/**