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.
This commit is contained in:
Stan Hu 2018-12-16 16:24:17 -08:00
parent 8b4602041c
commit 79a091b12a
3 changed files with 21 additions and 2 deletions

View File

@ -89,8 +89,9 @@ gem 'kaminari', '~> 1.0'
gem 'hamlit', '~> 2.8.8'
# Files attachments
# Locked until https://github.com/carrierwaveuploader/carrierwave/pull/2332/files is merged.
# config/initializers/carrierwave_patch.rb can be removed once that change is released.
# Locked until https://github.com/carrierwaveuploader/carrierwave/pull/2332 and
# https://github.com/carrierwaveuploader/carrierwave/pull/2356 are merged.
# config/initializers/carrierwave_patch.rb can be removed once both changes are released.
gem 'carrierwave', '= 1.2.3'
gem 'mini_magick'

View File

@ -0,0 +1,5 @@
---
title: Fix object storage not working properly with Google S3 compatibility
merge_request: 23858
author:
type: fixed

View File

@ -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