summaryrefslogtreecommitdiff
path: root/app/uploaders/gitlab_uploader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/uploaders/gitlab_uploader.rb')
-rw-r--r--app/uploaders/gitlab_uploader.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb
index cefcd3d3f5a..7dc211b14e4 100644
--- a/app/uploaders/gitlab_uploader.rb
+++ b/app/uploaders/gitlab_uploader.rb
@@ -99,6 +99,17 @@ class GitlabUploader < CarrierWave::Uploader::Base
end
end
+ # Used to replace an existing upload with another +file+ without modifying stored metadata
+ # Use this method only to repair/replace an existing upload, or to upload to a Geo secondary node
+ #
+ # @param [CarrierWave::SanitizedFile] file that will replace existing upload
+ # @return CarrierWave::SanitizedFile
+ def replace_file_without_saving!(file)
+ raise ArgumentError, 'should be a CarrierWave::SanitizedFile' unless file.is_a? CarrierWave::SanitizedFile
+
+ storage.store!(file)
+ end
+
private
# Designed to be overridden by child uploaders that have a dynamic path