summaryrefslogtreecommitdiff
path: root/config/initializers/carrierwave_patch.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-05 09:10:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-05 09:10:01 +0000
commit88ad172d0417292fc1bf70a0dfb3877a0ecb7c79 (patch)
treee776a9c0a62297c292131e2009e3fc8734ed44d5 /config/initializers/carrierwave_patch.rb
parentbd4eece38d24e421c8745c365f94be756589e892 (diff)
downloadgitlab-ce-88ad172d0417292fc1bf70a0dfb3877a0ecb7c79.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config/initializers/carrierwave_patch.rb')
-rw-r--r--config/initializers/carrierwave_patch.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/config/initializers/carrierwave_patch.rb b/config/initializers/carrierwave_patch.rb
new file mode 100644
index 00000000000..94a79e5990d
--- /dev/null
+++ b/config/initializers/carrierwave_patch.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require "carrierwave/storage/fog"
+
+# This pulls in https://github.com/carrierwaveuploader/carrierwave/pull/2504 to support
+# sending AWS S3 encryption headers when copying objects.
+module CarrierWave
+ module Storage
+ class Fog < Abstract
+ class File
+ def copy_to(new_path)
+ connection.copy_object(@uploader.fog_directory, file.key, @uploader.fog_directory, new_path, copy_to_options)
+ CarrierWave::Storage::Fog::File.new(@uploader, @base, new_path)
+ end
+
+ def copy_to_options
+ acl_header.merge(@uploader.fog_attributes)
+ end
+ end
+ end
+ end
+end