Class: ObjectStorage::DirectUploadStorage

Inherits:
CarrierWave::Storage::Fog
  • Object
show all
Extended by:
Gitlab::Utils::Override
Defined in:
app/uploaders/object_storage.rb

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Instance Method Details

#store!(file) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/uploaders/object_storage.rb', line 49

def store!(file)
  return super unless file.is_a?(::CarrierWave::Storage::Fog::File)
  return super unless @uploader.direct_upload_final_path.present?

  # The direct_upload_final_path is defined which means
  # file was uploaded to its final location so no need to move it.
  # Now we delete the pending upload entry as the upload is considered complete.
  pending_upload_path = @uploader.class.without_bucket_prefix(file.path)
  ObjectStorage::PendingDirectUpload.complete(@uploader.class.storage_location_identifier, pending_upload_path)

  file
end