From fc967a5ac2dee93376685d4fe9faababafe55491 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 18 Feb 2019 14:25:57 +0100 Subject: [PATCH] Make sure that we have a stream Signed-off-by: Roeland Jago Douma --- apps/dav/lib/Connector/Sabre/File.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 7767e83f50..388bcff920 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -167,6 +167,13 @@ class File extends Node implements IFile { } if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) { + + if (!is_resource($data)) { + $data = fopen('php://temp', 'r+'); + fwrite($data, 'foobar'); + rewind($data); + } + $isEOF = false; $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) { $isEOF = feof($stream);