Project

General

Profile

Actions

Defect #3391

closed

When reading RSS feed, the inline-embedded images are not properly shown.

Added by Jaeyoun Yi over 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Feeds
Target version:
Start date:
2009-05-20
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When the attached image files are embedded inline using ! ! wiki format,
RSS feed doesn't show the images properly because the URL of the images are not properly replaced.

To fix it, following modifications are needed in my opinion.

Line 26 of /app/views/issues/changes.rxml,

 xml.text! textilizable(change.notes) unless change.notes.blank?

should be modified to
 xml.text! textilizable(change.notes, :only_path => false, :attachments => issue.attachments) unless change.notes.blank?

  • And the Line 27 of /app/views/common/feed.atom.rxml,
     xml.text! textilizable(item.event_description, :only_path => false)
    

    should be modified to
     xml.text! textilizable(item.event_description, :only_path => false, :attachments => item.respond_to?(:attachments) ? item.attachments : nil)
    

Please, review these modifications to be inlcuded in the trunk.
Thanks.


Related issues

Related to Redmine - Defect #4204: Failing test in test_show_atomClosedEric Davis2009-11-12

Actions
Actions #1

Updated by Jean-Philippe Lang over 15 years ago

  • Category set to Feeds
  • Status changed from New to Resolved
  • Target version set to 0.8.5
  • Resolution set to Fixed

This is fixed in r2768.
Thanks for pointing this out.

Actions #2

Updated by Eric Davis over 15 years ago

  • Status changed from Resolved to 7
  • Assignee set to Jean-Philippe Lang
  • Resolution deleted (Fixed)

I got a failed test on this commit.

"Build c082cfc90ef8fccc77e808ae64db711777fd8f8c failed" 

Commit Message: FIxed: inline images not displayed in atom feeds (#3391).
Commit Date: 2009-05-26T08:28:36+00:00
Commit Author: Jean-Philippe Lang

Build Output:

(in /home/edavis/integrity/builds/edavis10-redmine-master)
/usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/unit/repository_filesystem_test.rb" "test/unit/project_test.rb" "test/unit/repository_darcs_test.rb" "test/unit/news_test.rb" "test/unit/wiki_page_test.rb" "test/unit/mailer_test.rb" "test/unit/watcher_test.rb" "test/unit/subversion_adapter_test.rb" "test/unit/custom_field_test.rb" "test/unit/wiki_content_test.rb" "test/unit/issue_test.rb" "test/unit/repository_subversion_test.rb" "test/unit/enumeration_test.rb" "test/unit/repository_bazaar_test.rb" "test/unit/query_test.rb" "test/unit/calendar_test.rb" "test/unit/time_entry_test.rb" "test/unit/repository_test.rb" "test/unit/enabled_module_test.rb" "test/unit/user_preference_test.rb" "test/unit/message_test.rb" "test/unit/repository_git_test.rb" "test/unit/document_test.rb" "test/unit/issue_status_test.rb" "test/unit/comment_test.rb" "test/unit/role_test.rb" "test/unit/setting_test.rb" "test/unit/user_test.rb" "tes
 t/unit/default_data_test.rb" "test/unit/wiki_test.rb" "test/unit/repository_mercurial_test.rb" "test/unit/lib/redmine/plugin_test.rb" "test/unit/lib/redmine/unified_diff_test.rb" "test/unit/lib/redmine/hook_test.rb" "test/unit/lib/redmine/wiki_formatting/macros_test.rb" "test/unit/lib/redmine/access_control_test.rb" "test/unit/lib/redmine/i18n_test.rb" "test/unit/lib/redmine/mime_type_test.rb" "test/unit/token_test.rb" "test/unit/mail_handler_test.rb" "test/unit/attachment_test.rb" "test/unit/version_test.rb" "test/unit/helpers/sort_helper_test.rb" "test/unit/helpers/custom_fields_helper_test.rb" "test/unit/helpers/application_helper_test.rb" "test/unit/wiki_redirect_test.rb" "test/unit/tracker_test.rb" "test/unit/mercurial_adapter_test.rb" "test/unit/board_test.rb" "test/unit/member_test.rb" "test/unit/auth_source_ldap_test.rb" "test/unit/filesystem_adapter_test.rb" "test/unit/journal_test.rb" "test/unit/search_test.rb" "test/unit/issue_category_test.rb" "test/unit/reposito
 ry_cvs_test.rb" "test/unit/activity_test.rb" "test/unit/changeset_test.rb" "test/unit/custom_value_test.rb" 
(in /home/edavis/integrity/builds/edavis10-redmine-master)
Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS.
Darcs test repository NOT FOUND. Skipping unit tests !!!
Subversion test repository NOT FOUND. Skipping unit tests !!!
Bazaar test repository NOT FOUND. Skipping unit tests !!!
Git test repository NOT FOUND. Skipping unit tests !!!
Mercurial test repository NOT FOUND. Skipping unit tests !!!
Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS.
CVS test repository NOT FOUND. Skipping unit tests !!!
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader
Started
......................................................................................................................................................................................................................................................................................................................................................................
Finished in 119.487271 seconds.

358 tests, 1607 assertions, 0 failures, 0 errors
/usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/functional/repositories_darcs_controller_test.rb" "test/functional/repositories_controller_test.rb" "test/functional/reports_controller_test.rb" "test/functional/repositories_cvs_controller_test.rb" "test/functional/workflows_controller_test.rb" "test/functional/users_controller_test.rb" "test/functional/attachments_controller_test.rb" "test/functional/versions_controller_test.rb" "test/functional/wikis_controller_test.rb" "test/functional/repositories_git_controller_test.rb" "test/functional/repositories_subversion_controller_test.rb" "test/functional/repositories_bazaar_controller_test.rb" "test/functional/members_controller_test.rb" "test/functional/issue_categories_controller_test.rb" "test/functional/my_controller_test.rb" "test/functional/watchers_controller_test.rb" "test/functional/documents_controller_test.rb" "test/functional/journals_controller_test.rb" 
 "test/functional/account_controller_test.rb" "test/functional/issues_controller_test.rb" "test/functional/roles_controller_test.rb" "test/functional/welcome_controller_test.rb" "test/functional/trackers_controller_test.rb" "test/functional/custom_fields_controller_test.rb" "test/functional/admin_controller_test.rb" "test/functional/boards_controller_test.rb" "test/functional/settings_controller_test.rb" "test/functional/sys_controller_test.rb" "test/functional/news_controller_test.rb" "test/functional/issue_relations_controller_test.rb" "test/functional/wiki_controller_test.rb" "test/functional/projects_controller_test.rb" "test/functional/messages_controller_test.rb" "test/functional/timelog_controller_test.rb" "test/functional/repositories_mercurial_controller_test.rb" "test/functional/queries_controller_test.rb" "test/functional/search_controller_test.rb" "test/functional/application_controller_test.rb" "test/functional/mail_handler_controller_test.rb" "test/functional/en
 umerations_controller_test.rb" 
/home/edavis/integrity/builds/edavis10-redmine-master/app/controllers/repositories_controller.rb:202: warning: already initialized constant REV_PARAM_RE
/home/edavis/integrity/builds/edavis10-redmine-master/app/controllers/my_controller.rb:31: warning: already initialized constant BLOCKS
/home/edavis/integrity/builds/edavis10-redmine-master/app/controllers/my_controller.rb:35: warning: already initialized constant DEFAULT_LAYOUT
Darcs test repository NOT FOUND. Skipping functional tests !!!
CVS test repository NOT FOUND. Skipping functional tests !!!
Git test repository NOT FOUND. Skipping functional tests !!!
Subversion test repository NOT FOUND. Skipping functional tests !!!
Bazaar test repository NOT FOUND. Skipping functional tests !!!
RMagick not installed. Skipping tests !!!
Mercurial test repository NOT FOUND. Skipping functional tests !!!
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader
Started
......................................................................................................................................................F....................................................................................................................................................................................................................................................................................................................
Finished in 68.488199 seconds.

  1) Failure:
test_show_atom(IssuesControllerTest)
    [./test/functional/issues_controller_test.rb:377:in `test_show_atom'
     /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'
     /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `run']:
<false> is not true.

459 tests, 1638 assertions, 1 failures, 0 errors
/usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/integration/account_test.rb" "test/integration/projects_test.rb" "test/integration/issues_test.rb" "test/integration/lib/redmine/menu_manager_test.rb" "test/integration/application_test.rb" "test/integration/admin_test.rb" 
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader
Started
....................
Finished in 11.366039 seconds.

20 tests, 137 assertions, 0 failures, 0 errors
Errors running test:functionals!

Actions #3

Updated by Eric Davis over 15 years ago

  • Status changed from 7 to Resolved
  • Assignee deleted (Jean-Philippe Lang)

Fixed the failing test in r2770.

Actions #4

Updated by Jean-Baptiste Barth over 15 years ago

I don't know if I missed something, but on my installation (svn r2777, see script/about below), the new "test_show_atom" fails, while old version seems to work:

$ ruby test/functional/issues_controller_test.rb --name test_show_atom
RMagick not installed. Skipping tests !!!
Loaded suite test/functional/issues_controller_test
Started
F
Finished in 0.810993 seconds.

  1) Failure:
test_show_atom(IssuesControllerTest)
    [test/functional/issues_controller_test.rb:377:in `test_show_atom'
     /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'
     /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `run']:
<false> is not true.

1 tests, 3 assertions, 1 failures, 0 errors

$ ruby script/about 
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.1
Rails version             2.2.2
Active Record version     2.2.2
Action Pack version       2.2.2
Active Resource version   2.2.2
Action Mailer version     2.2.2
Active Support version    2.2.2
Application root          /home/salvor/dev/redmine/trunk
Environment               development
Database adapter          sqlite3
Database schema version   20090503121510

Any idea in order to debug that ?

Actions #5

Updated by Mischa The Evil over 15 years ago

Jean-Baptiste Barth wrote:

I don't know if I missed something, but on my installation (svn r2777, see script/about below), the new "test_show_atom" fails, while old version seems to work:

[...]

I can confirm the same behaviour as Jean-Baptiste Barth using Redmine trunk at r2777 with a MySQL 4.1.x DB-backend.

# ruby script/about
About your application's environment
Ruby version              1.8.6 (i686-linux)
RubyGems version          1.3.1
Rails version             2.2.2
Active Record version     2.2.2
Action Pack version       2.2.2
Active Resource version   2.2.2
Action Mailer version     2.2.2
Active Support version    2.2.2
Application root          /path/to/redmine/trunk
Environment               development
Database adapter          mysql
Database schema version   20090503121510
Actions #6

Updated by Jean-Philippe Lang over 15 years ago

Same for me, r2770 breaks the test.
As you can see, double quotes are not escaped in the atom feed:

    <content type="html">
&lt;ul&gt;&lt;/ul&gt;&lt;p&gt;A comment with inline image: &lt;img src="http://t
est.host/attachments/download/10" alt="" /&gt;&lt;/p&gt;    </content>
Actions #7

Updated by Eric Davis over 15 years ago

In r2782, the test is working for me. Checking the response body, double quotes are escaped.

$ ruby test/functional/issues_controller_test.rb --name test_show_atom
Loaded suite test/functional/issues_controller_test
Started
.
Finished in 1.006513 seconds.

1 tests, 3 assertions, 0 failures, 0 errors
>> puts @response.body
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title></title>
  <link href="http://test.host/issues/2.atom" rel="self"/>
  <link href="http://test.host/" rel="alternate"/>
  <id>http://test.host/</id>
  <updated>2009-06-06T00:00:00-07:00</updated>
  <author>
    <name>Redmine</name>
  </author>
  <entry>
    <title>eCookbook - Feature request #2: Add ingredients categories</title>
    <link href="http://test.host/issues/2" rel="alternate"/>
    <id>http://test.host/issues/2?journal_id=3</id>
    <updated>2009-06-06T00:00:00-07:00</updated>
    <author>
      <name>John Smith</name>
      <email>jsmith@somenet.foo</email>
    </author>
    <content type="html">
&lt;ul&gt;&lt;/ul&gt;&lt;p&gt;A comment with inline image: &lt;img src=&quot;http://test.host/attachments/download/10&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;    </content>
  </entry>
</feed>

My environment is close to Mischa's, but I have MySQL 5.0. The test still if I switch to SQLite3.

$ ruby script/about
About your application's environment
Ruby version              1.8.6 (i486-linux)
RubyGems version          1.3.1
Rails version             2.2.2
Active Record version     2.2.2
Action Pack version       2.2.2
Active Resource version   2.2.2
Action Mailer version     2.2.2
Active Support version    2.2.2
Application root          /home/edavis/dev/redmine/redmine-core
Environment               development
Database adapter          mysql
Database schema version   20090503121510

$ mysql --version
mysql  Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2

The failed test I reported on the 26th was from another server. After r2770, that server reported the test passing.

Actions #8

Updated by Jean-Philippe Lang about 15 years ago

  • Status changed from Resolved to Closed

Merged in 0.8-stable in r2882.

Actions #9

Updated by Alexey Palazhchenko about 15 years ago

  • Status changed from Closed to Reopened

Sorry, r2936 doesn't works for me:

$ ruby test/functional/issues_controller_test.rb --name test_show_atom
Loaded suite test/functional/issues_controller_test
Started
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title></title>
  <link href="http://test.host/issues/2.atom" rel="self"/>
  <link href="http://test.host/" rel="alternate"/>
  <id>http://test.host/</id>
  <updated>2009-10-18T00:00:00+04:00</updated>
  <author>
    <name>Redmine</name>
  </author>
  <entry>
    <title>eCookbook - Feature request #2: Add ingredients categories</title>
    <link href="http://test.host/issues/2" rel="alternate"/>
    <id>http://test.host/issues/2?journal_id=3</id>
    <updated>2009-10-18T00:00:00+04:00</updated>
    <author>
      <name>John Smith</name>
      <email>jsmith@somenet.foo</email>
    </author>
    <content type="html">
&lt;ul&gt;&lt;/ul&gt;&lt;p&gt;A comment with inline image: &lt;img src="http://test.host/attachments/download/10" alt="" /&gt;&lt;/p&gt;    </content>
  </entry>
</feed>
F
Finished in 1.59943 seconds.

  1) Failure:
test_show_atom(IssuesControllerTest) [test/functional/issues_controller_test.rb:379]:
<false> is not true.

My environment:

$ ruby script/about
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          /home/aleksi/MyCode/redmine-github
Environment               development
Database adapter          mysql
Database schema version   20091017214750

Any thoughts?

Actions #10

Updated by Jean-Philippe Lang about 15 years ago

  • Status changed from Reopened to Closed

I reverted r2770 in r2960 since it seems to break the test for everyone, except Eric.
Eric, any idea?

Actions #11

Updated by Eric Davis about 15 years ago

Getting the same failure with that commit. My CI server is offline so I can't verify this on another system right now.

$ ruby test/functional/issues_controller_test.rb  -n /show_atom/
Loaded suite test/functional/issues_controller_test
Started
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title></title>
  <link href="http://test.host/issues/2.atom" rel="self"/>
  <link href="http://test.host/" rel="alternate"/>
  <id>http://test.host/</id>
  <updated>2009-10-25T00:00:00-07:00</updated>
  <author>
    <name>Redmine</name>
  </author>
  <entry>
    <title>eCookbook - Feature request #2: Add ingredients categories</title>
    <link href="http://test.host/issues/2" rel="alternate"/>
    <id>http://test.host/issues/2?journal_id=3</id>
    <updated>2009-10-25T00:00:00-07:00</updated>
    <author>
      <name>John Smith</name>
      <email>jsmith@somenet.foo</email>
    </author>
    <content type="html">
&lt;ul&gt;&lt;/ul&gt;&lt;p&gt;A comment with inline image: &lt;img src=&quot;http://test.host/attachments/download/10&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;    </content>
  </entry>
</feed>
F
Finished in 0.856275 seconds.

  1) Failure:
test_show_atom(IssuesControllerTest) [test/functional/issues_controller_test.rb:379]:
<false> is not true.

1 tests, 3 assertions, 1 failures, 0 errors

$ script/about 
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          /home/edavis/dev/redmine/redmine-core
Environment               development
Database adapter          mysql
Database schema version   20091025163651

Actions #12

Updated by michael turner over 14 years ago

I tried running the tests on my install of 0.9.3 and had one failure, which led me to this issue as it matches Eric's description above.

...

Finished in 157.2314 seconds.

  1) Failure:
test_show_atom(IssuesControllerTest) [/test/functional/issues_controller_test.rb:439]:
Body did not match. Body: <?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title></title>
  <link href="http://test.host/issues/2.atom" rel="self"/>
  <link href="http://test.host/" rel="alternate"/>
  <id>http://test.host/</id>
  <updated>2010-03-20T00:00:00-07:00</updated>
  <author>
    <name>Redmine</name>
  </author>
  <entry>
    <title>eCookbook - Feature request #2: Add ingredients categories</title>
    <link href="http://test.host/issues/2" rel="alternate"/>
    <id>http://test.host/issues/2?journal_id=3</id>
    <updated>2010-03-20T00:00:00-07:00</updated>
    <author>
      <name>John Smith</name>
      <email>jsmith@somenet.foo</email>
    </author>
    <content type="html">
&lt;ul&gt;&lt;/ul&gt;&lt;p&gt;A comment with inline image: &lt;img src=&quot;http://test.host/attachments/download/10&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;    </content>
  </entry>
</feed>
.
<false> is not true.

561 tests, 1956 assertions, 1 failures, 0 errors

...

after some searching turned up this issue, I tried adapting r2770 and sure enough the test now passed.

diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 14c20bb..7f57455 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -436,7 +436,10 @@ class IssuesControllerTest < ActionController::TestCase
     assert_response :success
     assert_template 'changes.rxml'
     # Inline image
-    assert @response.body.include?("&lt;img src=\"http://test.host/attachments/download/10\" alt=\"\" /&gt;"), "Body did not match. Body: #{@response.body}" 
+    ## this is the upstream version of the test, which fails on my build
+    #assert @response.body.include?("&lt;img src=\"http://test.host/attachments/download/10\" alt=\"\" /&gt;"), "Body did not match. Body: #{@response.body}" 
+    # this change was adapted from upstream r2770
+    assert @response.body.include?("&lt;img src=&quot;http://test.host/attachments/download/10&quot; alt=&quot;&quot; /&gt;"), "Body did not match. Body: #{@response.body}" 
   end

   def test_new_routing

which (running just the one test) results in

Loaded suite test/functional/issues_controller_test
Started
.
Finished in 1.8257 seconds.

1 tests, 3 assertions, 0 failures, 0 errors

This is my setup...

About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /home/michael/rails/redmine-093
Environment               development
Database adapter          sqlite3
Database schema version   20100221100219

perhaps the test needs to be rewritten to work with either escaped or unescaped quotes?

Actions

Also available in: Atom PDF