OSDN Git Service

tree view need use ascii-8bit, file name need be utf8.
authorSaito <saitowu@gmail.com>
Tue, 11 Sep 2012 11:18:14 +0000 (19:18 +0800)
committerSaito <saitowu@gmail.com>
Tue, 11 Sep 2012 11:18:14 +0000 (19:18 +0800)
app/helpers/tree_helper.rb
app/models/tree.rb
app/views/refs/_tree_file.html.haml

index c51ee84..a5d5c74 100644 (file)
@@ -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
index bc95d33..d65e50a 100644 (file)
@@ -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
index 765f271..f6566cc 100644 (file)
@@ -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"