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:
Diffstat (limited to 'apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php')
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php
index 68446d380e0..eb68d3800b3 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php
@@ -345,11 +345,17 @@ class Share extends AbstractShare {
// since returned stream is closed by the caller we need to create a new instance
// since we can't re-use the same file descriptor over multiple calls
$connection = $this->getConnection();
+ stream_set_blocking($connection->getOutputStream(), false);
$connection->write('get ' . $source . ' ' . $this->system->getFD(5));
$connection->write('exit');
$fh = $connection->getFileOutputStream();
- stream_context_set_option($fh, 'file', 'connection', $connection);
+ $fh = CallbackWrapper::wrap($fh, function() use ($connection) {
+ $connection->write('');
+ });
+ if (!is_resource($fh)) {
+ throw new Exception("Failed to wrap file output");
+ }
return $fh;
}
@@ -374,7 +380,9 @@ class Share extends AbstractShare {
// use a close callback to ensure the upload is finished before continuing
// this also serves as a way to keep the connection in scope
- $stream = CallbackWrapper::wrap($fh, null, null, function () use ($connection) {
+ $stream = CallbackWrapper::wrap($fh, function() use ($connection) {
+ $connection->write('');
+ }, null, function () use ($connection) {
$connection->close(false); // dont terminate, give the upload some time
});
if (is_resource($stream)) {
@@ -446,7 +454,7 @@ class Share extends AbstractShare {
* @return string[]
*/
protected function execute(string $command): array {
- $this->connect()->write($command . PHP_EOL);
+ $this->connect()->write($command);
return $this->connect()->read();
}