diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-10-17 18:47:05 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-10-17 18:47:05 +0300 |
commit | b8cf360e2ae446db1f21c0275e2047d776730a05 (patch) | |
tree | 08aad72c9813659459247c74fc46b6db4bc2cd91 /app/helpers/blob_helper.rb | |
parent | 11152ddf3d4f977232676fea38eca28b7b6e6ddd (diff) |
Fixed bug with the content disposition with wiki attachments
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 8d58c86b7a4..f7e087a6234 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -150,7 +150,9 @@ module BlobHelper # example of Javascript) we tell the browser of the victim not to # execute untrusted data. def safe_content_type(blob) - if blob.text? + if blob.extension == 'svg' + blob.mime_type + elsif blob.text? 'text/plain; charset=utf-8' elsif blob.image? blob.content_type @@ -159,6 +161,12 @@ module BlobHelper end end + def content_disposition(blob, inline) + return 'attachment' if blob.extension == 'svg' + + inline ? 'inline' : 'attachment' + end + def ref_project @ref_project ||= @target_project || @project end |