Module: SendsBlob

Extended by:
ActiveSupport::Concern
Included in:
Projects::AvatarsController, Projects::DesignManagement::Designs::RawImagesController, Projects::RawController, Snippets::SendBlob, WikiActions
Defined in:
app/controllers/concerns/sends_blob.rb

Instance Method Summary collapse

Instance Method Details

#send_blob(repository, blob, inline: true, allow_caching: false) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/concerns/sends_blob.rb', line 11

def send_blob(repository, blob, inline: true, allow_caching: false)
  if blob
    headers['X-Content-Type-Options'] = 'nosniff'

    return if cached_blob?(blob, allow_caching: allow_caching)

    if blob.stored_externally?
      send_lfs_object(blob, repository.project)
    else
      send_git_blob(repository, blob, inline: inline)
    end
  else
    render_404
  end
end