summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/BulkUpload
diff options
context:
space:
mode:
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>2023-07-07 11:22:19 +0200
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>2023-07-25 11:44:48 +0200
commit337b1b38860fbb80fbea449689b8c375ab25bb5b (patch)
tree4c6b91127506cadf61e848dbe5ec35c321bc2156 /apps/dav/lib/BulkUpload
parent6278a12c945ec30f12691020b4aeb8f3251ae278 (diff)
downloadnextcloud-server-337b1b38860fbb80fbea449689b8c375ab25bb5b.tar.gz
nextcloud-server-337b1b38860fbb80fbea449689b8c375ab25bb5b.zip
when reading an empty file getting EOF is not an error
will allow uploading empty files via bulk upload Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Diffstat (limited to 'apps/dav/lib/BulkUpload')
-rw-r--r--apps/dav/lib/BulkUpload/MultipartRequestParser.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/dav/lib/BulkUpload/MultipartRequestParser.php b/apps/dav/lib/BulkUpload/MultipartRequestParser.php
index 7554447fc93..16c83fee64e 100644
--- a/apps/dav/lib/BulkUpload/MultipartRequestParser.php
+++ b/apps/dav/lib/BulkUpload/MultipartRequestParser.php
@@ -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.");
}