summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaito <saitowu@gmail.com>2012-09-11 19:18:14 +0800
committerSaito <saitowu@gmail.com>2012-09-11 19:18:14 +0800
commit96d4f22e53a6176715f9557fb0707cb166a1dd80 (patch)
treecc5124d3a2c88df24df0261f846e5d2859c80ad8
parent1c08cb404d5e874ae7d79a540e493bbf1f0d3061 (diff)
downloadgitlab-ce-96d4f22e53a6176715f9557fb0707cb166a1dd80.tar.gz
tree view need use ascii-8bit, file name need be utf8.
-rw-r--r--app/helpers/tree_helper.rb3
-rw-r--r--app/models/tree.rb2
-rw-r--r--app/views/refs/_tree_file.html.haml2
3 files changed, 4 insertions, 3 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index c51ee84a25e..a5d5c742230 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -18,7 +18,8 @@ module TreeHelper
end
def tree_full_path(content)
- if params[:path]
+ content.name.force_encoding('utf-8')
+ if params[:path]
File.join(params[:path], content.name)
else
content.name
diff --git a/app/models/tree.rb b/app/models/tree.rb
index bc95d335520..d65e50ab817 100644
--- a/app/models/tree.rb
+++ b/app/models/tree.rb
@@ -16,7 +16,7 @@ class Tree
def initialize(raw_tree, project, ref = nil, path = nil)
@project, @ref, @path = project, ref, path,
@tree = if path
- raw_tree / path
+ raw_tree / path.dup.force_encoding('ascii-8bit')
else
raw_tree
end
diff --git a/app/views/refs/_tree_file.html.haml b/app/views/refs/_tree_file.html.haml
index 765f271a1bf..f6566ccf5d5 100644
--- a/app/views/refs/_tree_file.html.haml
+++ b/app/views/refs/_tree_file.html.haml
@@ -2,7 +2,7 @@
.file_title
%i.icon-file
%span.file_name
- = name
+ = name.force_encoding('utf-8')
%small #{file.mode}
%span.options
= link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank"