Skip to content

Commit

Permalink
Fix object storage not working properly with Google S3 compatibility
Browse files Browse the repository at this point in the history
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
carrierwaveuploader/carrierwave#2356.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53846.
  • Loading branch information
stanhu committed Dec 17, 2018
1 parent 8b46020 commit 4973110
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelogs/unreleased/sh-carrierwave-patch-google-acl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Fix Carrierwave not working properly with Google S3 compatibility
merge_request: 23858
author:
type: fixed
13 changes: 13 additions & 0 deletions config/initializers/carrierwave_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ def authenticated_url(options = {})
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
Expand Down

0 comments on commit 4973110

Please sign in to comment.