diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-11-21 18:34:00 +0100 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-11-21 18:38:25 +0100 |
commit | d087b4dac466fc7da6dbdc8668aea943af4546e8 (patch) | |
tree | 55fecf2aad3c464f699ba691ca252a88a6c7fb10 /app/uploaders | |
parent | a4072db0198896242886d22c644ed91c1016aa8d (diff) | |
download | gitlab-ce-d087b4dac466fc7da6dbdc8668aea943af4546e8.tar.gz |
FileUploader should check for hashed_storage?(:attachments) to use disk_path
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/file_uploader.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index d4ba3a028be..f4a5cf75018 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -26,11 +26,15 @@ class FileUploader < GitlabUploader # This is used to build Upload paths dynamically based on the model's current # namespace and path, allowing us to ignore renames or transfers. # - # model - Object that responds to `path_with_namespace` + # model - Object that responds to `full_path` and `disk_path` # # Returns a String without a trailing slash - def self.dynamic_path_segment(model) - File.join(CarrierWave.root, base_dir, model.disk_path) + def self.dynamic_path_segment(project) + if project.hashed_storage?(:attachments) + File.join(CarrierWave.root, base_dir, project.disk_path) + else + File.join(CarrierWave.root, base_dir, project.full_path) + end end attr_accessor :model |