Wiki links to repositories with underscore their identifiers don't work (#12979).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11281 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
10a38010fb
commit
f928f36070
|
@ -659,7 +659,7 @@ module ApplicationHelper
|
||||||
# identifier:version:1.0.0
|
# identifier:version:1.0.0
|
||||||
# identifier:source:some/file
|
# identifier:source:some/file
|
||||||
def parse_redmine_links(text, default_project, obj, attr, only_path, options)
|
def parse_redmine_links(text, default_project, obj, attr, only_path, options)
|
||||||
text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m|
|
text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-_]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m|
|
||||||
leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $18, $14 || $19, $15, $17
|
leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $18, $14 || $19, $15, $17
|
||||||
link = nil
|
link = nil
|
||||||
project = default_project
|
project = default_project
|
||||||
|
@ -748,7 +748,7 @@ module ApplicationHelper
|
||||||
when 'commit', 'source', 'export'
|
when 'commit', 'source', 'export'
|
||||||
if project
|
if project
|
||||||
repository = nil
|
repository = nil
|
||||||
if name =~ %r{^(([a-z0-9\-]+)\|)(.+)$}
|
if name =~ %r{^(([a-z0-9\-_]+)\|)(.+)$}
|
||||||
repo_prefix, repo_identifier, name = $1, $2, $3
|
repo_prefix, repo_identifier, name = $1, $2, $3
|
||||||
repository = project.repositories.detect {|repo| repo.identifier == repo_identifier}
|
repository = project.repositories.detect {|repo| repo.identifier == repo_identifier}
|
||||||
else
|
else
|
||||||
|
|
|
@ -408,14 +408,14 @@ RAW
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_multiple_repositories_redmine_links
|
def test_multiple_repositories_redmine_links
|
||||||
svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn1', :url => 'file:///foo/hg')
|
svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn_repo-1', :url => 'file:///foo/hg')
|
||||||
Changeset.create!(:repository => svn, :committed_on => Time.now, :revision => '123')
|
Changeset.create!(:repository => svn, :committed_on => Time.now, :revision => '123')
|
||||||
hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg')
|
hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg')
|
||||||
Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd')
|
Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd')
|
||||||
|
|
||||||
changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2},
|
changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2},
|
||||||
:class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3')
|
:class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3')
|
||||||
svn_changeset_link = link_to('svn1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn1', :rev => 123},
|
svn_changeset_link = link_to('svn_repo-1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn_repo-1', :rev => 123},
|
||||||
:class => 'changeset', :title => '')
|
:class => 'changeset', :title => '')
|
||||||
hg_changeset_link = link_to('hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'},
|
hg_changeset_link = link_to('hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'},
|
||||||
:class => 'changeset', :title => '')
|
:class => 'changeset', :title => '')
|
||||||
|
@ -425,7 +425,7 @@ RAW
|
||||||
|
|
||||||
to_test = {
|
to_test = {
|
||||||
'r2' => changeset_link,
|
'r2' => changeset_link,
|
||||||
'svn1|r123' => svn_changeset_link,
|
'svn_repo-1|r123' => svn_changeset_link,
|
||||||
'invalid|r123' => 'invalid|r123',
|
'invalid|r123' => 'invalid|r123',
|
||||||
'commit:hg1|abcd' => hg_changeset_link,
|
'commit:hg1|abcd' => hg_changeset_link,
|
||||||
'commit:invalid|abcd' => 'commit:invalid|abcd',
|
'commit:invalid|abcd' => 'commit:invalid|abcd',
|
||||||
|
|
Loading…
Reference in New Issue