Merge pull request #22604 from owncloud/fix-google-drive-encryption
Copy into local file
This commit is contained in:
commit
202bf17e4a
1 changed files with 11 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue