Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-11-24 11:59:21 +0300
committerGabriel Mazetto <brodock@gmail.com>2017-11-28 13:22:23 +0300
commit58f32622ce9c2d08001da7b91065942cdc5a0f4a (patch)
tree8a476daa179fa9eb9e0839f886714d74c91c5cec /app/uploaders/file_uploader.rb
parentdc62441ffd47d63f342c6accbd5049f6e8f99303 (diff)
Changes to Attachments Migration for EE and Geo compatibility
Diffstat (limited to 'app/uploaders/file_uploader.rb')
-rw-r--r--app/uploaders/file_uploader.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb
index f4a5cf75018..71658df5b41 100644
--- a/app/uploaders/file_uploader.rb
+++ b/app/uploaders/file_uploader.rb
@@ -31,12 +31,19 @@ class FileUploader < GitlabUploader
# Returns a String without a trailing slash
def self.dynamic_path_segment(project)
if project.hashed_storage?(:attachments)
- File.join(CarrierWave.root, base_dir, project.disk_path)
+ dynamic_path_builder(project.disk_path)
else
- File.join(CarrierWave.root, base_dir, project.full_path)
+ dynamic_path_builder(project.full_path)
end
end
+ # Auxiliary method to build dynamic path segment when not using a project model
+ #
+ # Prefer to use the `.dynamic_path_segment` as it includes Hashed Storage specific logic
+ def self.dynamic_path_builder(path)
+ File.join(CarrierWave.root, base_dir, path)
+ end
+
attr_accessor :model
attr_reader :secret