mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
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>
This commit is contained in:
parent
58fd016b27
commit
6bdd9d123e
1 changed files with 8 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue