diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index b79f42d1e009..8c19d8d08c12 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -35,6 +35,7 @@ use GuzzleHttp\Exception\RequestException; use Icewind\Streams\IteratorDirectory; +use Icewind\Streams\RetryWrapper; set_include_path(get_include_path().PATH_SEPARATOR. \OC_App::getAppPath('files_external').'/3rdparty/google-api-php-client/src'); @@ -441,10 +442,9 @@ public function fopen($path, $mode) { // the library's service doesn't support streaming, so we use Guzzle instead $client = \OC::$server->getHTTPClientService()->newClient(); try { - $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); - $client->get($downloadUrl, [ + $response = $client->get($downloadUrl, [ 'headers' => $httpRequest->getRequestHeaders(), - 'save_to' => $tmpFile, + 'stream' => true ]); } catch (RequestException $e) { if(!is_null($e->getResponse())) { @@ -458,7 +458,8 @@ public function fopen($path, $mode) { } } - return fopen($tmpFile, 'r'); + $handle = $response->getBody(); + return RetryWrapper::wrap($handle); } } return false;