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 <salimbelakkaf@outlook.de>
  • Loading branch information
grnd-alt authored and backportbot[bot] committed Apr 12, 2024
1 parent bc08f02 commit 1037190
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 1037190

Please sign in to comment.