summaryrefslogtreecommitdiff
path: root/app/uploaders
diff options
context:
space:
mode:
authorAndreas Kämmerle <andreas.kaemmerle@gmail.com>2018-09-13 12:00:59 +0200
committerAndreas Kämmerle <andreas.kaemmerle@gmail.com>2018-09-13 12:00:59 +0200
commit87d01cc3bfc12c08024881dc8f13101e5430e3e6 (patch)
tree05e82defa51500257f97e3530862da03668895e3 /app/uploaders
parentfef5c923c009c64183cc43909444a1bdaba218b7 (diff)
parent71f3d48544cc0857c8d470b182f7e809de6a4642 (diff)
downloadgitlab-ce-87d01cc3bfc12c08024881dc8f13101e5430e3e6.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into consolidate-page-widths-part02consolidate-page-widths-part02
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/avatar_uploader.rb4
-rw-r--r--app/uploaders/namespace_file_uploader.rb22
2 files changed, 17 insertions, 9 deletions
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb
index b29ef57b071..c0165759203 100644
--- a/app/uploaders/avatar_uploader.rb
+++ b/app/uploaders/avatar_uploader.rb
@@ -18,6 +18,10 @@ class AvatarUploader < GitlabUploader
false
end
+ def absolute_path
+ self.class.absolute_path(model.avatar.upload)
+ end
+
private
def dynamic_segment
diff --git a/app/uploaders/namespace_file_uploader.rb b/app/uploaders/namespace_file_uploader.rb
index 52969762b7d..4965bd7f057 100644
--- a/app/uploaders/namespace_file_uploader.rb
+++ b/app/uploaders/namespace_file_uploader.rb
@@ -6,23 +6,27 @@ class NamespaceFileUploader < FileUploader
options.storage_path
end
- def self.base_dir(model, _store = nil)
- File.join(options.base_dir, 'namespace', model_path_segment(model))
+ def self.base_dir(model, store = nil)
+ base_dirs(model)[store || Store::LOCAL]
+ end
+
+ def self.base_dirs(model)
+ {
+ Store::LOCAL => File.join(options.base_dir, 'namespace', model_path_segment(model)),
+ Store::REMOTE => File.join('namespace', model_path_segment(model))
+ }
end
def self.model_path_segment(model)
File.join(model.id.to_s)
end
+ def self.workhorse_local_upload_path
+ File.join(options.storage_path, 'uploads', TMP_UPLOAD_PATH)
+ end
+
# Re-Override
def store_dir
store_dirs[object_store]
end
-
- def store_dirs
- {
- Store::LOCAL => File.join(base_dir, dynamic_segment),
- Store::REMOTE => File.join('namespace', self.class.model_path_segment(model), dynamic_segment)
- }
- end
end