From 427b23c12718bea233931431e7d9307881a960c0 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 3 Oct 2019 00:05:59 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/uploaders/gitlab_uploader.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/uploaders/gitlab_uploader.rb') 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 -- cgit v1.2.3