##// END OF EJS Templates
Fixed that #parse_redmine_links errors when given a link tag without attributes (#19304)....
Jean-Philippe Lang -
r14392:58d3dc354d68
parent child
Show More
@@ -742,7 +742,7 module ApplicationHelper
742 # identifier:source:some/file
742 # identifier:source:some/file
743 def parse_redmine_links(text, default_project, obj, attr, only_path, options)
743 def parse_redmine_links(text, default_project, obj, attr, only_path, options)
744 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|
744 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|
745 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
745 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
746 if tag_content
746 if tag_content
747 $&
747 $&
748 else
748 else
@@ -1263,6 +1263,13 RAW
1263 end
1263 end
1264 end
1264 end
1265
1265
1266 def test_parse_redmine_links_should_handle_a_tag_without_attributes
1267 text = '<a>http://example.com</a>'
1268 expected = text.dup
1269 parse_redmine_links(text, nil, nil, nil, true, {})
1270 assert_equal expected, text
1271 end
1272
1266 def test_due_date_distance_in_words
1273 def test_due_date_distance_in_words
1267 to_test = { Date.today => 'Due in 0 days',
1274 to_test = { Date.today => 'Due in 0 days',
1268 Date.today + 1 => 'Due in 1 day',
1275 Date.today + 1 => 'Due in 1 day',
General Comments 0
You need to be logged in to leave comments. Login now