summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-03-23 15:38:20 +0100
committerVincent Petry <pvince81@owncloud.com>2016-03-23 18:06:01 +0100
commit02c25684429f18ff2c655ede2a4e87c201e1a2a7 (patch)
treec67f51d366dad66e89e027d72d041cc0d8c9c128 /apps/files_external
parentea07a428f463a866b2c5e44e243a33d8980c8850 (diff)
downloadnextcloud-server-02c25684429f18ff2c655ede2a4e87c201e1a2a7.tar.gz
nextcloud-server-02c25684429f18ff2c655ede2a4e87c201e1a2a7.zip
Dropbox stream download with RetryWrapper
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/dropbox.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index f59b5a460e1..8381ccbae59 100644
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -29,7 +29,9 @@
namespace OC\Files\Storage;
+use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory;
+use Icewind\Streams\RetryWrapper;
require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';
@@ -257,10 +259,9 @@ class Dropbox extends \OC\Files\Storage\Common {
$client = \OC::$server->getHTTPClientService()->newClient();
try {
- $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
- $client->get($downloadUrl, [
+ $response = $client->get($downloadUrl, [
'headers' => $headers,
- 'save_to' => $tmpFile,
+ 'stream' => true,
]);
} catch (RequestException $e) {
if (!is_null($e->getResponse())) {
@@ -274,7 +275,8 @@ class Dropbox extends \OC\Files\Storage\Common {
}
}
- return fopen($tmpFile, 'r');
+ $handle = $response->getBody();
+ return RetryWrapper::wrap($handle);
} catch (\Exception $exception) {
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;