]> source.dussan.org Git - nextcloud-server.git/commitdiff
when reading an empty file getting EOF is not an error 39510/head
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 7 Jul 2023 09:22:19 +0000 (11:22 +0200)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 24 Jul 2023 11:29:33 +0000 (13:29 +0200)
will allow uploading empty files via bulk upload

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
apps/dav/lib/BulkUpload/MultipartRequestParser.php

index 7554447fc93b8b8263466f35d5e6e380aede803f..16c83fee64e31fbd2805167583d81afb14df6ba7 100644 (file)
@@ -211,13 +211,17 @@ class MultipartRequestParser {
                        throw new BadRequest("Computed md5 hash is incorrect.");
                }
 
-               $content = stream_get_line($this->stream, $length);
+               if ($length === 0) {
+                       $content = '';
+               } else {
+                       $content = stream_get_line($this->stream, $length);
+               }
 
                if ($content === false) {
                        throw new Exception("Fail to read part's content.");
                }
 
-               if (feof($this->stream)) {
+               if ($length !== 0 && feof($this->stream)) {
                        throw new Exception("Unexpected EOF while reading stream.");
                }