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 committed Apr 11, 2024
1 parent 77efd63 commit b72d576
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 @@ -485,7 +485,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 b72d576

Please sign in to comment.