Fixing swift fopen by ensuring stream is a valid resource

This commit is contained in:
Daniel Tosello 2015-12-10 16:36:28 +11:00
parent cb9a4d4cdc
commit 41f1feaf23
1 changed files with 4 additions and 1 deletions

View File

@ -323,7 +323,10 @@ class Swift extends \OC\Files\Storage\Common {
$streamInterface->rewind();
$stream = $streamInterface->getStream();
stream_context_set_option($stream, 'swift','content', $streamInterface);
return $stream;
if(is_resource($stream)) {
return $stream;
}
return false;
} catch (\Guzzle\Http\Exception\BadResponseException $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;