summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/application_helper.rb7
-rw-r--r--app/helpers/repositories_helper.rb4
-rw-r--r--test/unit/helpers/application_helper_test.rb2
3 files changed, 7 insertions, 6 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index fdc541645..6266dd951 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -112,6 +112,10 @@ module ApplicationHelper
type ? CodeRay.scan(content, type).html : h(content)
end
+ def to_path_param(path)
+ path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
+ end
+
def pagination_links_full(paginator, count=nil, options={})
page_param = options.delete(:page_param) || :page
url_param = params.dup
@@ -349,7 +353,8 @@ module ApplicationHelper
if project && project.repository
name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
path, rev, anchor = $1, $3, $5
- link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, :path => path,
+ link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project,
+ :path => to_path_param(path),
:rev => rev,
:anchor => anchor,
:format => (prefix == 'export' ? 'raw' : nil)},
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 59e1e0fb9..852ed18d7 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -32,10 +32,6 @@ module RepositoriesHelper
end
end
- def to_path_param(path)
- path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
- end
-
def to_utf8(str)
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
@encodings ||= Setting.repositories_encodings.split(',').collect(&:strip)
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 45eb2df90..d4f9e0247 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -81,7 +81,7 @@ class ApplicationHelperTest < HelperTestCase
version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2},
:class => 'version')
- source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => 'some/file'}
+ source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
to_test = {
# tickets