Merge branch 'fix_encoding' of https://github.com/brodock/gitlabhq into brodock-fix_encoding
Conflicts: lib/gitlab/encode.rb
This commit is contained in:
commit
d72f8db08a
5 changed files with 29 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
class RefsController < ApplicationController
|
||||
include Gitlabhq::Encode
|
||||
before_filter :project
|
||||
|
||||
# Authorize
|
||||
|
@ -43,23 +44,26 @@ class RefsController < ApplicationController
|
|||
no_cache_headers
|
||||
end
|
||||
end
|
||||
rescue
|
||||
return render_404
|
||||
end
|
||||
|
||||
def blob
|
||||
if @tree.is_blob?
|
||||
if @tree.text?
|
||||
encoding = detect_encoding(@tree.data)
|
||||
mime_type = encoding ? "text/plain; charset=#{encoding}" : "text/plain"
|
||||
else
|
||||
mime_type = @tree.mime_type
|
||||
end
|
||||
|
||||
send_data(
|
||||
@tree.data,
|
||||
:type => @tree.text? ? "text/plain" : @tree.mime_type,
|
||||
:type => mime_type,
|
||||
:disposition => 'inline',
|
||||
:filename => @tree.name
|
||||
)
|
||||
else
|
||||
head(404)
|
||||
end
|
||||
rescue
|
||||
return render_404
|
||||
end
|
||||
|
||||
def blame
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue