Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-17 03:24:17 +0300
committerStan Hu <stanhu@gmail.com>2018-12-17 22:58:16 +0300
commit79a091b12aab9c41085840eb7db28d9787dd2573 (patch)
treea8d05864088d5d310d1c607c0982fda6451a7936 /config/initializers/carrierwave_patch.rb
parent8b4602041cf2c4a8738a4796d78720017249249f (diff)
Fix object storage not working properly with Google S3 compatibility
Even in AWS S3 compatibility mode, Google now appears to reject requests that includes this header with this error: ``` Requests cannot specify both x-amz and x-goog headers ``` This has been submitted upstream via https://github.com/carrierwaveuploader/carrierwave/pull/2356. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53846.
Diffstat (limited to 'config/initializers/carrierwave_patch.rb')
-rw-r--r--config/initializers/carrierwave_patch.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/initializers/carrierwave_patch.rb b/config/initializers/carrierwave_patch.rb
index 35ffff03abe..c361784491d 100644
--- a/config/initializers/carrierwave_patch.rb
+++ b/config/initializers/carrierwave_patch.rb
@@ -23,6 +23,19 @@ module CarrierWave
end
end
end
+
+ # Fix for https://github.com/carrierwaveuploader/carrierwave/pull/2356
+ def acl_header
+ if fog_provider == 'AWS'
+ { 'x-amz-acl' => @uploader.fog_public ? 'public-read' : 'private' }
+ else
+ {}
+ end
+ end
+
+ def fog_provider
+ @uploader.fog_credentials[:provider].to_s
+ end
end
end
end