diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-09 17:30:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-09 17:30:09 +0000 |
commit | 858d175c1527d650ea5d83e201777d0cf8ae84c9 (patch) | |
tree | 147344d5699ea84eda6f980867e4d2045e0f22b9 /app/models/uploads/fog.rb | |
parent | f6262510e6642bb91d112f1bf2ea70db8b7b772c (diff) | |
download | gitlab-ce-858d175c1527d650ea5d83e201777d0cf8ae84c9.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-ee
Diffstat (limited to 'app/models/uploads/fog.rb')
-rw-r--r-- | app/models/uploads/fog.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/models/uploads/fog.rb b/app/models/uploads/fog.rb index 5d57b644dbe..d2b8eab9f0d 100644 --- a/app/models/uploads/fog.rb +++ b/app/models/uploads/fog.rb @@ -21,7 +21,9 @@ module Uploads private def delete_object(key) - connection.delete_object(bucket_name, key) + return unless available? + + connection.delete_object(bucket_name, object_key(key)) # So far, only GoogleCloudStorage raises an exception when the file is not found. # Other providers support idempotent requests and does not raise an error @@ -35,11 +37,16 @@ module Uploads end def bucket_name - return unless available? - object_store.remote_directory end + def object_key(key) + # We allow administrators to create "sub buckets" by setting a prefix. + # This makes it possible to deploy GitLab with only one object storage + # bucket. This mirrors the implementation in app/uploaders/object_storage.rb. + File.join([object_store.bucket_prefix, key].compact) + end + def connection return unless available? |