diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-12-31 10:13:09 +0100 |
---|---|---|
committer | Francisco Javier López <fjlopez@gitlab.com> | 2018-12-31 13:02:32 +0100 |
commit | 2cd47bba9a4ee1b503b37c548826ef527c4e49ba (patch) | |
tree | 5eac568727d03feb18677b7eab85c77f8eb2e5bd /lib/api/helpers.rb | |
parent | 77909a88460bbc864a5f95f3fa66053eb6cab5a8 (diff) | |
download | gitlab-ce-2cd47bba9a4ee1b503b37c548826ef527c4e49ba.tar.gz |
Fixed api content-disposition in blob and files endpoint
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index c3eca713712..6c1a730935a 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -496,7 +496,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['Content-Disposition'] = content_disposition('attachment', blob.name) header(*Gitlab::Workhorse.send_git_blob(repository, blob)) end @@ -529,5 +529,11 @@ module API params[:archived] end + + def content_disposition(disposition, filename) + disposition += %(; filename=#{filename.inspect}) if filename.present? + + disposition + end end end |