2018-07-04 13:32:46 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
class LfsObjectUploader < GitlabUploader
|
|
|
|
extend Workhorse::UploadPath
|
|
|
|
include ObjectStorage::Concern
|
2015-10-12 10:42:14 -04:00
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
storage_options Gitlab.config.lfs
|
|
|
|
|
2018-10-03 11:09:16 -04:00
|
|
|
alias_method :upload, :model
|
|
|
|
|
2015-10-12 10:42:14 -04:00
|
|
|
def filename
|
2017-12-05 09:31:33 -05:00
|
|
|
model.oid[4..-1]
|
2015-10-12 10:42:14 -04:00
|
|
|
end
|
2017-06-01 16:15:46 -04:00
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
def store_dir
|
|
|
|
dynamic_segment
|
|
|
|
end
|
|
|
|
|
2017-09-07 17:27:04 -04:00
|
|
|
private
|
|
|
|
|
2018-02-02 08:59:43 -05:00
|
|
|
def dynamic_segment
|
|
|
|
File.join(model.oid[0, 2], model.oid[2, 2])
|
2017-06-01 16:15:46 -04:00
|
|
|
end
|
2015-10-12 10:42:14 -04:00
|
|
|
end
|