Allow writing an empty file with the new writeStream

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-11-05 17:00:04 +01:00
parent 9ea6573416
commit 665a6d2055
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 4 additions and 0 deletions

View File

@ -167,6 +167,10 @@ class File extends Node implements IFile {
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
$count = $partStorage->writeStream($internalPartPath, $data);
$result = $count > 0;
if ($result === false) {
$result = feof($data);
}
} else {
$target = $partStorage->fopen($internalPartPath, 'wb');
if ($target === false) {