Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-02-14 18:46:30 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2019-02-15 10:41:39 +0300
commit3720add736e7a3974ff869d92bca5e454ec302a4 (patch)
tree231986ad36f34597010df1125aefcb1719beaa42 /apps/dav/lib/Connector/Sabre/File.php
parent61d66d79544e3bd17a4f96a569fc24596ec414db (diff)
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>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/File.php')
-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 {