diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-06 12:43:51 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-06 12:43:51 +0000 |
commit | 8c6c3eab5cab4ba3e849fce5dba87eb0edb25285 (patch) | |
tree | 6011c10d57a2c0a47f5d8e66058106e93ab15f74 /app | |
parent | bc9a8494d2e67493e3ec701384fe5377207e8bcd (diff) | |
download | redmine-8c6c3eab5cab4ba3e849fce5dba87eb0edb25285.tar.gz redmine-8c6c3eab5cab4ba3e849fce5dba87eb0edb25285.zip |
Fixes "source:" links URLs (r1617).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1640 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 7 | ||||
-rw-r--r-- | app/helpers/repositories_helper.rb | 4 |
2 files changed, 6 insertions, 5 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) |