diff options
Diffstat (limited to 'app/uploaders/object_storage.rb')
-rw-r--r-- | app/uploaders/object_storage.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index 1d56cddca63..891df5180d8 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -353,6 +353,20 @@ module ObjectStorage } end + def store_path(*args) + if self.object_store == Store::REMOTE + # We allow administrators to create "sub buckets" by setting a prefix. + # This makes it possible to deploy GitLab with only one object storage + # bucket. Because the prefix is configuration data we do not want to + # store it in the uploads table via RecordsUploads. That means that the + # prefix cannot be part of store_dir. This is why we chose to implement + # the prefix support here in store_path. + File.join([self.class.object_store_options.bucket_prefix, super].compact) + else + super + end + end + # Returns all the possible paths for an upload. # the `upload.path` is a lookup parameter, and it may change # depending on the `store` param. |