mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 17:52:02 -04:00
Use a tmp file for swift writes
Else this leads to a seekable stream error with chunked uploads Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
3acee4f1b4
commit
30e790606e
1 changed files with 10 additions and 1 deletions
|
|
@ -76,9 +76,18 @@ class Swift implements IObjectStore {
|
|||
* @throws \Exception from openstack lib when something goes wrong
|
||||
*/
|
||||
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([
|
||||
'name' => $urn,
|
||||
'stream' => stream_for($stream)
|
||||
'stream' => stream_for($handle)
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue