Defect #4204

Failing test in test_show_atom

Added by Eric Davis almost 12 years ago. Updated over 11 years ago.

Status:ClosedStart date:2009-11-12
Priority:NormalDue date:
Assignee:Eric Davis% Done:


Target version:0.9.4
Resolution:Fixed Affected version:


(Pulling this out of the discussion from #3391)

I'm getting a failing test in the test_show_atom(IssuesControllerTest) but it's not reproducible by others. Going to try to work on a patch here.

Related issues

Related to Redmine - Defect #3391: When reading RSS feed, the inline-embedded images are not... Closed 2009-05-20

Associated revisions

Revision 3033
Added by Eric Davis almost 12 years ago

Adding the body of the feed to the failure message. #4204

Revision 3558
Added by Eric Davis over 11 years ago

Use assert_select to check the download link. (#4204)


#1 Updated by Eric Davis almost 12 years ago

Looks like an environment issue, since both the test and actual code are escaping quotes (img src="...):

# Test
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="">
  <link href="" rel="self"/>
  <link href="" rel="alternate"/>
    <title>eCookbook - Feature request #2: Add ingredients categories</title>
    <link href="" rel="alternate"/>
      <name>John Smith</name>
    <content type="html">
&lt;ul&gt;&lt;/ul&gt;&lt;p&gt;A comment with inline image: &lt;img src=&quot;; alt=&quot;&quot; /&gt;&lt;/p&gt;    </content>

Atom feed (displays the image properly):

    <title>Digitized 24 hour firmware - Bug #398: Face to face fault-tolerant approach</title>
    <link href="http://localhost:3000/issues/398" rel="alternate"/>
      <name>Redmine Admin</name>
    <content type="html">

&lt;ul&gt;&lt;li&gt;&lt;strong&gt;File&lt;/strong&gt; &lt;a href=&quot;/attachments/5/redmine-error.png&quot;&gt;redmine-error.png&lt;/a&gt; added&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Test &lt;img src=&quot;http://localhost:3000/attachments/download/5&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;    </content>

#2 Updated by Eric Davis almost 12 years ago

This might be from Builder. I'm running 2.1.2 which includes this:

Version 2.0.0 introduces automatically escaped attribute values for the first time. Versions prior to 2.0.0 did not insert escape characters into attribute values in the XML markup. This allowed attribute values to explicitly reference entities, which was occasionally used by a small number of developers. Since strings could always be explicitly escaped by hand, this was not a major restriction in functionality.

However, it did suprise most users of builder. Since the body text is normally escaped, everybody expected the attribute values to be escaped as well. Escaped attribute values were the number one support request on the 1.x Builder series.

Starting with Builder version 2.0.0, all attribute values expressed as strings will be processed and the appropriate characters will be escaped (e.g. "&" will be tranlated to "&"). Attribute values that are expressed as Symbol values will not be processed for escaped characters and will be unchanged in output. (Yes, this probably counts as Symbol abuse, but the convention is convenient and flexible).


Running this by hand, the textilized attributes are escaped:

>> xml =
=> inspect
>> xml.text! textilizable(change, :notes, :only_path => false)
=> "<inspect/>&lt;p&gt;Test &lt;img src=&quot;http://localhost:3000/attachments/download/5&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;" 

I don't see any specific version of Builder required for Rails, so maybe we are running different versions which is causing the different output. Jean-Philippe, what version of builder do you have?

#3 Updated by Jean-Philippe Lang almost 12 years ago

I'm using builder 2.1.2 too.

#4 Updated by Jean-Philippe Lang almost 12 years ago

Double quotes are not escaped:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'builder'
=> true
irb(main):003:0> xml =
=> <inspect/>
irb(main):004:0> xml.text! '<img src="foo.png" />'
=> "<inspect/>&lt;img src=\"foo.png\" /&gt;" 


gem list --local builder

*** LOCAL GEMS ***

builder (2.1.2)

#5 Updated by Eric Davis over 11 years ago

  • Status changed from 7 to Resolved
  • Target version set to 0.9.4
  • % Done changed from 0 to 100
  • Resolution set to Fixed

Jean-Philippe Lang:

I'm still getting this error and have been since I reported this. I've committed r3558 to try and use a different method of checking the atom response. Let me know if it doesn't work on your system.

#6 Updated by Jean-Philippe Lang over 11 years ago

  • Status changed from Resolved to Closed

It seems to be OK. Merged in 0.9-stable.

Also available in: Atom PDF