summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-31 20:07:36 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-31 20:07:36 +0200
commitdea3985e86638ba451c79c84ca0b473a2aab99b8 (patch)
tree60f2a496883c39fd85becf4f849c51360d6086cb /apps/files_external
parentba8c81e6d172ff39fbf9a05438c4d6025d280f0d (diff)
parent02c25684429f18ff2c655ede2a4e87c201e1a2a7 (diff)
downloadnextcloud-server-dea3985e86638ba451c79c84ca0b473a2aab99b8.tar.gz
nextcloud-server-dea3985e86638ba451c79c84ca0b473a2aab99b8.zip
Merge pull request #23516 from owncloud/dropbox-stream-download
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;