diff options
author | Toon Claes <toon@gitlab.com> | 2018-10-03 15:09:16 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-03 15:09:16 +0000 |
commit | c5597547a1b907adb036b8341ebaaf1647ea3461 (patch) | |
tree | f9fe912a7d6d9f33f3522bfb8af27c31b9a85920 /app/uploaders/gitlab_uploader.rb | |
parent | f4db21eb22eeb9e07a9f5850d496570992f6d1f9 (diff) | |
download | gitlab-ce-c5597547a1b907adb036b8341ebaaf1647ea3461.tar.gz |
Backport of "Use Geo log to remove files when migrated to object storage"
Diffstat (limited to 'app/uploaders/gitlab_uploader.rb')
-rw-r--r-- | app/uploaders/gitlab_uploader.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index 719bd6ef418..cefcd3d3f5a 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -63,6 +63,12 @@ class GitlabUploader < CarrierWave::Uploader::Base super || file&.filename end + def relative_path + return path if pathname.relative? + + pathname.relative_path_from(Pathname.new(root)) + end + def model_valid? !!model end @@ -115,4 +121,8 @@ class GitlabUploader < CarrierWave::Uploader::Base # the cache directory. File.join(work_dir, cache_id, version_name.to_s, for_file) end + + def pathname + @pathname ||= Pathname.new(path) + end end |