https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292015-03-08T15:20:34ZRedmineRedmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=620492015-03-08T15:20:34ZPavel Rosický
<ul><li><strong>File</strong> <a href="/attachments/13280">application_helper.rb.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/13280/application_helper.rb.patch">application_helper.rb.patch</a> added</li></ul> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=621142015-03-10T19:47:16ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li><li><strong>Resolution</strong> set to <i>Cant reproduce</i></li></ul><p>I'm not able to reproduce, could you write a test case for this?</p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=621222015-03-10T23:39:32ZPavel Rosický
<ul><li><strong>File</strong> <a href="/attachments/13295">application_helper_test.rb.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/13295/application_helper_test.rb.patch">application_helper_test.rb.patch</a> added</li></ul><p>I forgot, that standard textile formatters unescape html tags before, but this method should handle this anyway. Test case attached.</p>
<p>Original result: error<br />With patch: returns nil as it should</p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=628382015-04-06T04:24:44ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>New</i></li><li><strong>Target version</strong> set to <i>3.0.2</i></li><li><strong>Resolution</strong> deleted (<del><i>Cant reproduce</i></del>)</li></ul> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=628392015-04-06T04:27:17ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/18301">Defect #18301</a>: Revision shortlink at end of URL breaks URL autolinking</i> added</li></ul> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=628412015-04-06T04:46:21ZToshi MARUYAMA
<ul><li><strong>Related to</strong> deleted (<i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/18301">Defect #18301</a>: Revision shortlink at end of URL breaks URL autolinking</i>)</li></ul> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=628432015-04-06T04:50:21ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li><li><strong>Target version</strong> deleted (<del><i>3.0.2</i></del>)</li><li><strong>Resolution</strong> set to <i>Cant reproduce</i></li></ul><p>I cannot reproduce too.<br /><pre><code class="diff syntaxhl"><span class="gh">diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
</span><span class="gd">--- a/test/unit/helpers/application_helper_test.rb
</span><span class="gi">+++ b/test/unit/helpers/application_helper_test.rb
</span><span class="p">@@ -1261,6 +1261,19 @@</span> RAW
end
end
+ def test_should_handle_a_tag_without_attributes
<span class="gi">+ text = '<a>http://example.com</a>'
+ with_settings :text_formatting => 'textile' do
+ assert_not_nil textilizable(text)
+ end
+ with_settings :text_formatting => 'markdown' do
+ assert_not_nil textilizable(text)
+ end
+ with_settings :text_formatting => 'unknown' do
+ assert_not_nil textilizable(text)
+ end
+ end
+
</span> def test_due_date_distance_in_words
to_test = { Date.today => 'Due in 0 days',
Date.today + 1 => 'Due in 1 day',
</code></pre></p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=657972015-09-04T20:30:04ZPavel Rosický
<ul></ul><p>Hi, this bug is still present, but you can reproduce it only if you use non-redmine custom text formatter which supports html (like ckeditor, markdown/textile formatter escape brackets, so <a> will be &\lt;a&\gt; and the affected regex will not fail).<br />To avoid that I need to patch this method and gsub! these occurances, which causes unnecessary overhead. Or I can patch the whole method (~140 lines!!! definetely worth to refactor) only because of one character.</p>
<p>Can someone take a look at it again? Patch, test-case and backtrace are already attached.</p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=663672015-10-04T03:57:03ZToshi MARUYAMA
<ul></ul><p>Pavel Rosický wrote:</p>
<blockquote>
<p>Hi, this bug is still present, but you can reproduce it only if you use non-redmine custom text formatter which supports html (like ckeditor, markdown/textile formatter escape brackets, so <a> will be <a> and the affected regex will not fail).</p>
</blockquote>
<p>Could you add test cases for it?</p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=663792015-10-04T09:19:15ZPavel Rosický
<ul></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p>Could you add test cases for it?</p>
</blockquote>
<p>I already did, 7 months ago.</p>
<p>Test case - <a class="external" href="http://www.redmine.org/attachments/13295/application_helper_test.rb.patch">http://www.redmine.org/attachments/13295/application_helper_test.rb.patch</a> :</p>
<pre>
def test_should_handle_a_tag_without_attributes
text = '<a>http://example.com</a>'
assert_nil parse_redmine_links(text, nil, nil, nil, true, {})
end
</pre>
<p>Without patch:<br /> 1) Error:<br />ApplicationHelperTest#test_should_handle_a_tag_without_attributes:<br />NoMethodError: undefined method `+' for nil:NilClass<br /> app/helpers/application_helper.rb:873:in `block in parse_redmine_links'<br /> app/helpers/application_helper.rb:742:in `gsub!'<br /> app/helpers/application_helper.rb:742:in `parse_redmine_links'<br /> test/unit/helpers/application_helper_test.rb:1262:in `test_should_handle_a_t<br />ag_without_attributes'<br />94 runs, 379 assertions, 0 failures, 1 errors, 0 skips</p>
<p>With patch - <a class="external" href="http://www.redmine.org/attachments/13280/application_helper.rb.patch">http://www.redmine.org/attachments/13280/application_helper.rb.patch</a> :<br />94 runs, 380 assertions, 0 failures, 0 errors, 0 skips</p>
<p>What else can I do?<br />If you want to test textilizable(), I'll have to include ckeditor and a custom html formatter (plugin). Such tests can't be included in a standard Redmine's test suite.</p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=669482015-10-30T06:13:50ZToshi MARUYAMA
<ul></ul><p>Pavel Rosický wrote:</p>
<blockquote>
<p>If you want to test textilizable(), I'll have to include ckeditor and a custom html formatter (plugin).</p>
</blockquote>
<p>Could you add dummy formatter?</p> Redmine - Defect #19304: <a> tag without attributes in description results in undefined method + for nil:NilClasshttps://www.redmine.org/issues/19304?journal_id=669802015-10-31T09:37:08ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Category</strong> changed from <i>Text formatting</i> to <i>Code cleanup/refactoring</i></li><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Target version</strong> set to <i>3.2.0</i></li></ul><p>Fixed in <a class="changeset" title="Fixed that #parse_redmine_links errors when given a link tag without attributes (#19304)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/14774">r14774</a>.</p>