summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-25 14:35:39 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-25 14:35:39 +0100
commit202bf17e4acff00d48ffd94ed95d83e53f3dec90 (patch)
tree0a3ba612fdf1f94bafc9940600edd82390dbccd8
parent5ecf2d5987e2d975043f6e758bc32978211f5d65 (diff)
parentaebb900cd45a38ba9e7f6dfd6217e83e260dc40f (diff)
downloadnextcloud-server-202bf17e4acff00d48ffd94ed95d83e53f3dec90.tar.gz
nextcloud-server-202bf17e4acff00d48ffd94ed95d83e53f3dec90.zip
Merge pull request #22604 from owncloud/fix-google-drive-encryption
Copy into local file
-rw-r--r--apps/files_external/lib/google.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index ee7a7383615..3e8b60d33df 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -33,6 +33,7 @@
namespace OC\Files\Storage;
+use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory;
set_include_path(get_include_path().PATH_SEPARATOR.
@@ -439,19 +440,24 @@ 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 {
- $response = $client->get($downloadUrl, [
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
+ $client->get($downloadUrl, [
'headers' => $httpRequest->getRequestHeaders(),
- 'stream' => true
+ 'save_to' => $tmpFile,
]);
} catch (RequestException $e) {
- if ($e->getResponse()->getStatusCode() === 404) {
- return false;
+ if(!is_null($e->getResponse())) {
+ if ($e->getResponse()->getStatusCode() === 404) {
+ return false;
+ } else {
+ throw $e;
+ }
} else {
throw $e;
}
}
- return $response->getBody();
+ return fopen($tmpFile, 'r');
}
}
return false;