From f6d57162bd2e343546585710abcb506ffef9c07b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 12 Jun 2023 16:38:02 +0200 Subject: [PATCH] also log stream size when reporting unexpected chunk size Signed-off-by: Robin Appelman --- apps/dav/lib/Upload/AssemblyStream.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php index ef6d39974c0ad..c8f98c7642fa9 100644 --- a/apps/dav/lib/Upload/AssemblyStream.php +++ b/apps/dav/lib/Upload/AssemblyStream.php @@ -153,10 +153,14 @@ public function stream_read($count) { $this->currentNodeRead += $read; if (feof($this->currentStream)) { + $streamStat = fstat($this->currentStream); fclose($this->currentStream); $currentNodeSize = $this->nodes[$this->currentNode]->getSize(); if ($this->currentNodeRead < $currentNodeSize) { - throw new \Exception('Stream from assembly node shorter than expected, got ' . $this->currentNodeRead . ' bytes, expected ' . $currentNodeSize); + throw new \Exception('Stream from assembly node shorter than expected, got ' . + $this->currentNodeRead . ' bytes, node size is reported as ' . + $currentNodeSize . 'B, stream is reported as ' . $streamStat['size'] . 'B' + ); } $this->currentNode++; $this->currentNodeRead = 0;