diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-11-23 16:44:09 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-11-23 16:44:09 +0000 |
commit | 9a5703ec82d394c2549f5afda7280c889d4cc373 (patch) | |
tree | a4a5b2fdaccf5743cff5871fe7b6bac47b42f6cf /lib | |
parent | 63c1ad18b77e24af53e6c56fd45f8b2fa5994018 (diff) | |
download | gitlab-ce-9a5703ec82d394c2549f5afda7280c889d4cc373.tar.gz |
Set content disposition attachment to several endpoints
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers.rb | 1 | ||||
-rw-r--r-- | lib/api/snippets.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 60bf977f0e4..9fda73d5b92 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -494,6 +494,7 @@ module API def send_git_blob(repository, blob) env['api.format'] = :txt content_type 'text/plain' + header['Content-Disposition'] = "attachment; filename=#{blob.name.inspect}" header(*Gitlab::Workhorse.send_git_blob(repository, blob)) end diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index 1ae144ca9c1..326d55afd0e 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -146,6 +146,7 @@ module API env['api.format'] = :txt content_type 'text/plain' + header['Content-Disposition'] = 'attachment' present snippet.content end # rubocop: enable CodeReuse/ActiveRecord |