Skip to content

Commit

Permalink
Fix files preview. Set charset=utf-8 in Content-Type header (#1254)
Browse files Browse the repository at this point in the history
* Fix files preview. Set charset=utf-8 in Content-Type header

* Render text formats as text/plain
  • Loading branch information
msquee authored Jun 29, 2021
1 parent a0769fb commit 8e41a52
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions apps/dashboard/app/models/files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,10 @@ def self.mime_type_for_preview(type)
# x === 'application/x-yaml'
# # => true
#
case type
when 'text/javascript', 'text/css', 'text/yaml', 'text/yml'
'text/plain'
else
if %r{text/.*}.match(type).nil?
type
else
'text/plain; charset=utf-8'
end
end

Expand Down

0 comments on commit 8e41a52

Please sign in to comment.