summaryrefslogtreecommitdiff
path: root/app/uploaders/lfs_object_uploader.rb
blob: 28085b310837712ae030988964280158950e0dee (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
# encoding: utf-8

class LfsObjectUploader < CarrierWave::Uploader::Base
  storage :file

  def store_dir
    "#{Gitlab.config.lfs.storage_path}/#{model.oid[0,2]}/#{model.oid[2,2]}"
  end

  def cache_dir
    "#{Gitlab.config.lfs.storage_path}/tmp/cache"
  end

  def move_to_cache
    true
  end

  def move_to_store
    true
  end

  def exists?
    file.try(:exists?)
  end

  def filename
    model.oid[4..-1]
  end
end