Skip to content
Snippets Groups Projects
Commit ebf7758d authored by Jörn Friedrich Dreyer's avatar Jörn Friedrich Dreyer
Browse files

Merge pull request #10595 from owncloud/swift-stream

Stream downloads from Swift object stores without downloading it first
parents adca48aa 191a82e7
Branches
No related tags found
No related merge requests found
......@@ -120,12 +120,11 @@ class Swift implements IObjectStore {
$objectContent = $object->getContent();
$objectContent->rewind();
// directly returning the object stream does not work because the GC seems to collect it, so we need a copy
$tmpStream = fopen('php://temp', 'r+');
stream_copy_to_stream($objectContent->getStream(), $tmpStream);
rewind($tmpStream);
$stream = $objectContent->getStream();
// save the object content in the context of the stream to prevent it being gc'd until the stream is closed
stream_context_set_option($stream, 'swift','content', $objectContent);
return $tmpStream;
return $stream;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment