Merge pull request #15168 from nextcloud/fix/13554/always_tmpfile_for_swift
Always use a temp file for swift writes
This commit is contained in:
commit
402930521a
|
@ -76,14 +76,9 @@ 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;
|
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
|
||||||
|
file_put_contents($tmpFile, $stream);
|
||||||
$meta = stream_get_meta_data($stream);
|
$handle = fopen($tmpFile, 'rb');
|
||||||
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,
|
||||||
|
|
Loading…
Reference in New Issue