Skip to content
Snippets Groups Projects
Unverified Commit 1b27e957 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #14424 from nextcloud/fix/13554/swift_to_tmp

Use a tmp file for swift writes
parents 540ec4f3 1153123b
No related branches found
No related tags found
No related merge requests found
...@@ -76,9 +76,18 @@ class Swift implements IObjectStore { ...@@ -76,9 +76,18 @@ class Swift implements IObjectStore {
* @throws \Exception from openstack lib when something goes wrong * @throws \Exception from openstack lib when something goes wrong
*/ */
public function writeObject($urn, $stream) { public function writeObject($urn, $stream) {
$handle = $stream;
$meta = stream_get_meta_data($stream);
if (!(isset($meta['seekable']) && $meta['seekable'] === true)) {
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
file_put_contents($tmpFile, $stream);
$handle = fopen($tmpFile, 'rb');
}
$this->getContainer()->createObject([ $this->getContainer()->createObject([
'name' => $urn, 'name' => $urn,
'stream' => stream_for($stream) 'stream' => stream_for($handle)
]); ]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment