Commit 96d4f22e53a6176715f9557fb0707cb166a1dd80

Authored by Saito
1 parent 1c08cb40

tree view need use ascii-8bit, file name need be utf8.

app/helpers/tree_helper.rb
@@ -18,7 +18,8 @@ module TreeHelper @@ -18,7 +18,8 @@ module TreeHelper
18 end 18 end
19 19
20 def tree_full_path(content) 20 def tree_full_path(content)
21 - if params[:path] 21 + content.name.force_encoding('utf-8')
  22 + if params[:path]
22 File.join(params[:path], content.name) 23 File.join(params[:path], content.name)
23 else 24 else
24 content.name 25 content.name
app/models/tree.rb
@@ -16,7 +16,7 @@ class Tree @@ -16,7 +16,7 @@ class Tree
16 def initialize(raw_tree, project, ref = nil, path = nil) 16 def initialize(raw_tree, project, ref = nil, path = nil)
17 @project, @ref, @path = project, ref, path, 17 @project, @ref, @path = project, ref, path,
18 @tree = if path 18 @tree = if path
19 - raw_tree / path 19 + raw_tree / path.dup.force_encoding('ascii-8bit')
20 else 20 else
21 raw_tree 21 raw_tree
22 end 22 end
app/views/refs/_tree_file.html.haml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 .file_title 2 .file_title
3 %i.icon-file 3 %i.icon-file
4 %span.file_name 4 %span.file_name
5 - = name 5 + = name.force_encoding('utf-8')
6 %small #{file.mode} 6 %small #{file.mode}
7 %span.options 7 %span.options
8 = link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank" 8 = link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank"