Skip to content

Commit ec4ae84

Browse files
authored
Merge pull request #39221 from nextcloud/bugfix/bulkUploadEmptyFiles
Bugfix/bulk upload empty files
2 parents a4dd35e + 906a661 commit ec4ae84

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/dav/lib/BulkUpload/MultipartRequestParser.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,17 @@ private function readPartContent(int $length, string $md5): string {
211211
throw new BadRequest("Computed md5 hash is incorrect.");
212212
}
213213

214-
$content = stream_get_line($this->stream, $length);
214+
if ($length === 0) {
215+
$content = '';
216+
} else {
217+
$content = stream_get_line($this->stream, $length);
218+
}
215219

216220
if ($content === false) {
217221
throw new Exception("Fail to read part's content.");
218222
}
219223

220-
if (feof($this->stream)) {
224+
if ($length !== 0 && feof($this->stream)) {
221225
throw new Exception("Unexpected EOF while reading stream.");
222226
}
223227

0 commit comments

Comments
 (0)