summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Karlitschek <karlitschek@gmx.de>2016-03-31 21:17:10 +0200
committerFrank Karlitschek <karlitschek@gmx.de>2016-03-31 21:17:10 +0200
commit6d40e69e2916792b8a0aa6ee5747dc919f758e89 (patch)
treea30f23bf963b1969ffcdf5bf3eff5d449d9159d0
parent3142dcc331964fc725a56b78e1d40b2e21cb9e5a (diff)
parent7be541bda18bd60b15f19154fdfd3a0624992462 (diff)
downloadnextcloud-server-6d40e69e2916792b8a0aa6ee5747dc919f758e89.tar.gz
nextcloud-server-6d40e69e2916792b8a0aa6ee5747dc919f758e89.zip
Merge pull request #23517 from owncloud/gdrive-stream-download
GDrive stream download with RetryWrapper
-rw-r--r--apps/files_external/lib/google.php9
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;