Skip to content

Commit

Permalink
don't alter file when there is not enough free space
Browse files Browse the repository at this point in the history
Signed-off-by: grnd-alt <[email protected]>
  • Loading branch information
grnd-alt authored and juliusknorr committed Apr 12, 2024
1 parent b71c321 commit c37ce0b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,13 @@ public function putFile($fileId,

$content = fopen('php://input', 'rb');

$freespace = $file->getParent()->getFreeSpace();
$contentLength = (int)$this->request->getHeader('Content-Length');

try {
if ($freespace >= 0 && $contentLength > $freespace) {
throw new \Exception('Not enough storage');
}
$this->wrappedFilesystemOperation($wopi, function () use ($file, $content) {
return $file->putContent($content);
});
Expand Down

0 comments on commit c37ce0b

Please sign in to comment.