Skip to content

Commit

Permalink
also log stream size when reporting unexpected chunk size
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Jun 12, 2023
1 parent 63bf207 commit ee023bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/dav/lib/Upload/AssemblyStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ee023bc

Please sign in to comment.