debian-mirror-gitlab/app/controllers/concerns/snippets/send_blob.rb

23 lines
421 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# 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