diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-03-23 14:55:03 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-03-30 18:39:41 +0200 |
commit | 7be541bda18bd60b15f19154fdfd3a0624992462 (patch) | |
tree | e415d377f50a09edaf097541bf7058b96693a70d | |
parent | 510e8db1ba4dfe3b6454d7a8d6dea3168a8b93c5 (diff) | |
download | nextcloud-server-7be541bda18bd60b15f19154fdfd3a0624992462.tar.gz nextcloud-server-7be541bda18bd60b15f19154fdfd3a0624992462.zip |
GDrive stream download with RetryWrapper
-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; |