Skip to content
Snippets Groups Projects
Commit 38cebe03 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Dont allow html render for RAW view

parent 1de270c9
No related branches found
No related tags found
Loading
Loading
@@ -11,9 +11,17 @@ class Projects::RawController < Projects::ApplicationController
Loading
@@ -11,9 +11,17 @@ class Projects::RawController < Projects::ApplicationController
@blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path) @blob = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, @path)
   
if @blob.exists? if @blob.exists?
type = if @blob.mime_type =~ /html|javascript/
'text/plain; charset=utf-8'
else
@blob.mime_type
end
headers['X-Content-Type-Options'] = 'nosniff'
send_data( send_data(
@blob.data, @blob.data,
type: @blob.mime_type, type: type,
disposition: 'inline', disposition: 'inline',
filename: @blob.name filename: @blob.name
) )
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment