Skip to content

Commit

Permalink
Merge pull request #3578 from nextcloud/backport/3562/stable28
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Apr 12, 2024
2 parents b71c321 + c37ce0b commit e934bfa
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 e934bfa

Please sign in to comment.