diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-31 23:14:49 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-31 23:14:49 +0200 |
commit | e3cc82df386d6a0b80cd843c8e08b7349e7f11e6 (patch) | |
tree | 5108b04bae0db56639228b5a677c5e2c4a6e18a1 /apps/files_external | |
parent | 05fd4f2da03f0421409be2116d82efd09cd916dd (diff) | |
parent | 99843c06f96d8381393bef2f42a0733beb1e2f51 (diff) | |
download | nextcloud-server-e3cc82df386d6a0b80cd843c8e08b7349e7f11e6.tar.gz nextcloud-server-e3cc82df386d6a0b80cd843c8e08b7349e7f11e6.zip |
Merge pull request #23518 from owncloud/stable9-gdrive-stream-download
[stable9] GDrive stream download with RetryWrapper
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/google.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index 91e7dfee08d..62d264dfeef 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -35,6 +35,7 @@ namespace OC\Files\Storage; 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 @@ class Google extends \OC\Files\Storage\Common { // 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, 'verify' => __DIR__ . '/../3rdparty/google-api-php-client/src/Google/IO/cacerts.pem', ]); } catch (RequestException $e) { @@ -459,7 +459,8 @@ class Google extends \OC\Files\Storage\Common { } } - return fopen($tmpFile, 'r'); + $handle = $response->getBody(); + return RetryWrapper::wrap($handle); } } return false; |