gitlab-org--gitlab-foss/app/controllers/concerns/snippets/send_blob.rb

22 lines
421 B
Ruby

# frozen_string_literal: true
module Snippets::SendBlob
include SendsBlob
def send_snippet_blob(snippet, blob)
workhorse_set_content_type!
send_blob(
snippet.repository,
blob,
inline: content_disposition == 'inline',
allow_caching: snippet.public?
)
end
private
def content_disposition
@disposition ||= params[:inline] == 'false' ? 'attachment' : 'inline'
end
end