summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-02-14 16:46:30 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-02-19 10:16:11 +0100
commit6bdd9d123e435093a4673cc86166dc59af13ffe3 (patch)
tree4285b589dc73d5fcfe9d5e2fd9b7ceeb92e267ef
parent58fd016b27f32655148f573671c5bb125b2eca48 (diff)
downloadnextcloud-server-6bdd9d123e435093a4673cc86166dc59af13ffe3.tar.gz
nextcloud-server-6bdd9d123e435093a4673cc86166dc59af13ffe3.zip
Add a wrapper to determine if a file is EOF
The stream is already closed at this point. Which means feof will always return false. We have to determine if the stream is EOF in the preCloseCallback. And pass this info along. Then the logic works as expected. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index f948f0f552d..7767e83f508 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -36,6 +36,7 @@
namespace OCA\DAV\Connector\Sabre;
+use Icewind\Streams\CallbackWrapper;
use OC\AppFramework\Http\Request;
use OC\Files\Filesystem;
use OC\Files\View;
@@ -166,10 +167,15 @@ class File extends Node implements IFile {
}
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
- $count = $partStorage->writeStream($internalPartPath, $data);
+ $isEOF = false;
+ $wrappedData = CallbackWrapper::wrap($data, null, null, null, null, function($stream) use (&$isEOF) {
+ $isEOF = feof($stream);
+ });
+
+ $count = $partStorage->writeStream($internalPartPath, $wrappedData);
$result = $count > 0;
if ($result === false) {
- $result = feof($data);
+ $result = $isEOF;
}
} else {