Better fix for encoding problems on rendering of inline file visualizations like README files.
This commit is contained in:
parent
eb5749ed39
commit
39def0dcbb
3 changed files with 6 additions and 3 deletions
|
@ -42,9 +42,9 @@
|
||||||
.readme
|
.readme
|
||||||
- if content.name =~ /\.(md|markdown)$/i
|
- if content.name =~ /\.(md|markdown)$/i
|
||||||
= preserve do
|
= preserve do
|
||||||
= markdown(content.data.force_encoding('UTF-8'))
|
= markdown(content.data.detect_encoding!)
|
||||||
- else
|
- else
|
||||||
= simple_format(content.data.force_encoding('UTF-8'))
|
= simple_format(content.data.detect_encoding!)
|
||||||
|
|
||||||
- if params[:path]
|
- if params[:path]
|
||||||
- history_path = tree_file_project_ref_path(@project, @ref, params[:path])
|
- history_path = tree_file_project_ref_path(@project, @ref, params[:path])
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#tree-readme-holder
|
#tree-readme-holder
|
||||||
.readme
|
.readme
|
||||||
= preserve do
|
= preserve do
|
||||||
= markdown(file.data.force_encoding('UTF-8'))
|
= markdown(file.data.detect_encoding!)
|
||||||
- else
|
- else
|
||||||
.view_file_content
|
.view_file_content
|
||||||
- unless file.empty?
|
- unless file.empty?
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Patch Strings to enable detect_encoding! on views
|
||||||
|
require 'charlock_holmes/string'
|
||||||
|
|
||||||
module Gitlabhq
|
module Gitlabhq
|
||||||
module Encode
|
module Encode
|
||||||
extend self
|
extend self
|
||||||
|
|
Loading…
Reference in a new issue