blob: 4b6dbe5b3583ac711fe2a1b120c72f64c7c342c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# frozen_string_literal: true
class Packages::PackageFileUploader < GitlabUploader
extend Workhorse::UploadPath
include ObjectStorage::Concern
storage_options Gitlab.config.packages
after :store, :schedule_background_upload
alias_method :upload, :model
def filename
model.file_name
end
def store_dir
dynamic_segment
end
private
def dynamic_segment
raise ObjectNotReadyError, "Package model not ready" unless model.id
package_segment = model.package.debian? ? 'debian' : model.package.id
Gitlab::HashedPath.new('packages', package_segment, 'files', model.id, root_hash: model.package.project_id)
end
end
|