From 97d24593c24f8ea6e5fc7e0e48e68e9ad8257c59 Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Mon, 8 Apr 2024 15:58:46 +0200 Subject: [PATCH] use contentLength header to determine quota exceeded Signed-off-by: grnd-alt --- lib/Controller/WopiController.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php index 9139240227..d1d2efded2 100644 --- a/lib/Controller/WopiController.php +++ b/lib/Controller/WopiController.php @@ -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) {