Skip to content

Commit

Permalink
use contentLength header to determine quota exceeded
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 10, 2024
1 parent e07428a commit 97d2459
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,10 @@ public function putFile($fileId,
$content = fopen('php://input', 'rb');

$freespace = $file->getParent()->getFreeSpace();

// Get expected FileSize after writing
fseek($content, 0, SEEK_END);
$finalSize = ftell($content);
rewind($content);
$contentLength = $this->request->getHeader('CONTENT_LENGTH');

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

0 comments on commit 97d2459

Please sign in to comment.