mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 17:56:03 +01:00
Fixed that #parse_redmine_links errors when given a link tag without attributes (#19304).
git-svn-id: http://svn.redmine.org/redmine/trunk@14774 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -742,7 +742,7 @@ module ApplicationHelper
|
|||||||
# 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{<a( [^>]+?)?>(.*?)</a>|([\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{<a( [^>]+?)?>(.*?)</a>|([\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|
|
||||||
tag_content, leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $3, $4, $5, $6, $7, $12, $13, $10 || $14 || $20, $16 || $21, $17, $19
|
tag_content, leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $2, $3, $4, $5, $6, $7, $12, $13, $10 || $14 || $20, $16 || $21, $17, $19
|
||||||
if tag_content
|
if tag_content
|
||||||
$&
|
$&
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1263,6 +1263,13 @@ RAW
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_redmine_links_should_handle_a_tag_without_attributes
|
||||||
|
text = '<a>http://example.com</a>'
|
||||||
|
expected = text.dup
|
||||||
|
parse_redmine_links(text, nil, nil, nil, true, {})
|
||||||
|
assert_equal expected, text
|
||||||
|
end
|
||||||
|
|
||||||
def test_due_date_distance_in_words
|
def test_due_date_distance_in_words
|
||||||
to_test = { Date.today => 'Due in 0 days',
|
to_test = { Date.today => 'Due in 0 days',
|
||||||
Date.today + 1 => 'Due in 1 day',
|
Date.today + 1 => 'Due in 1 day',
|
||||||
|
|||||||
Reference in New Issue
Block a user