Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2018-10-17 18:47:05 +0300
committerDouwe Maan <douwe@gitlab.com>2018-10-17 18:47:05 +0300
commitb8cf360e2ae446db1f21c0275e2047d776730a05 (patch)
tree08aad72c9813659459247c74fc46b6db4bc2cd91 /app/helpers/blob_helper.rb
parent11152ddf3d4f977232676fea38eca28b7b6e6ddd (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.rb10
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