aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2014-11-07 22:52:07 -0800
committerAdam Williamson <awilliam@redhat.com>2014-11-07 22:52:07 -0800
commitc237acb3953791f77b52f89efb7229e59606fdc0 (patch)
treea114b4859fb48861f276c7e30360ff3d9c0a6a5f /apps/files_external
parentb3bccce267a81e15d5ced3a4800aac4bd11b26ee (diff)
downloadnextcloud-server-c237acb3953791f77b52f89efb7229e59606fdc0.tar.gz
nextcloud-server-c237acb3953791f77b52f89efb7229e59606fdc0.zip
google: disable compression when curl is not available
This is a slightly hacky workaround for https://github.com/google/google-api-php-client/issues/59 . There's a bug in the Google library which makes it go nuts on file uploads and transfer *way* too much data if compression is enabled and it's using its own IO handler (not curl). Upstream 'fixed' this (by disabling compression) for one upload mechanism, but not for the one we use. The bug doesn't seem to happen if the google lib detects that curl is available and decides to use it instead of its own handler. So, let's disable compression, but only if it looks like the Google lib's check for curl is going to fail.
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/google.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 76ad1e4b0f6..27885f356c7 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -52,6 +52,12 @@ class Google extends \OC\Files\Storage\Common {
$this->client->setClientSecret($params['client_secret']);
$this->client->setScopes(array('https://www.googleapis.com/auth/drive'));
$this->client->setAccessToken($params['token']);
+ // if curl isn't available we're likely to run into
+ // https://github.com/google/google-api-php-client/issues/59
+ // - disable gzip to avoid it.
+ if (!function_exists('curl_version') || !function_exists('curl_exec')) {
+ $this->client->setClassConfig("Google_Http_Request", "disable_gzip", true);
+ }
// note: API connection is lazy
$this->service = new \Google_Service_Drive($this->client);
$token = json_decode($params['token'], true);