diff options
Diffstat (limited to 'app/helpers/workhorse_helper.rb')
-rw-r--r-- | app/helpers/workhorse_helper.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/helpers/workhorse_helper.rb b/app/helpers/workhorse_helper.rb index f74b53d68a1..28dd1b00292 100644 --- a/app/helpers/workhorse_helper.rb +++ b/app/helpers/workhorse_helper.rb @@ -7,7 +7,7 @@ module WorkhorseHelper def send_git_blob(repository, blob, inline: true) headers.store(*Gitlab::Workhorse.send_git_blob(repository, blob)) - headers['Content-Disposition'] = inline ? 'inline' : 'attachment' + headers['Content-Disposition'] = inline ? 'inline' : content_disposition_attachment(repository.project, blob.name) # If enabled, this will override the values set above workhorse_set_content_type! @@ -48,4 +48,12 @@ module WorkhorseHelper def workhorse_set_content_type! headers[Gitlab::Workhorse::DETECT_HEADER] = "true" end + + def content_disposition_attachment(project, filename) + if Feature.enabled?(:attachment_with_filename, project, default_enabled: :yaml) + ActionDispatch::Http::ContentDisposition.format(disposition: 'attachment', filename: filename) + else + 'attachment' + end + end end |