Project

General

Profile

Actions

Defect #14139

closed

Issue Via Email With Image Attachments and Embeded Images Breaks Issue Page

Added by David Leimbach over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

When an issue is created or updated with an image attachment or image embedded in the email the page for that issue responds with an Error 500.

This problem seems to be caused by the view template not handling nulls in the DB. Specifically records in the attachments table with a null value in the description field caused this Error 500.

We did manage a temporary workaround that may point to a solution. In mysql we made description field have a default of 'email attachment' and not null.
mysql workaround:
alter table attachments change description description varchar(255) not null default 'email attachment';

This solved the problem but this should most likely be best fixed in the code, not in the database and there could of course be side effects we're unaware of (thought it seems unlikely).

Environment:
About your application's environment
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 2.0.0
Rack version 1.4
Rails version 3.2.12
Active Record version 3.2.12
Action Pack version 3.2.12
Active Resource version 3.2.12
Action Mailer version 3.2.12
Active Support version 3.2.12
Middleware Rack::Cache, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x7f741a176200>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication
Environment production
Database adapter mysql
Database schema version 20121026003537

Log:
MailHandler: issue #1170 created by xxxxxxx
398758 Rendered text template (0.0ms)
398759 Completed 201 Created in 1882ms (Views: 1.5ms | ActiveRecord: 61.6ms)
398760 Started GET "/projects/cms/issues" for 10.1.20.1 at Thu May 23 18:54:06 +0300 2013
398761 Processing by IssuesController#index as HTML
398762 Parameters: {"project_id"=>"cms"}
398763 Current user: xxxxx (id=4)
398764 Rendered queries/_filters.html.erb (78.5ms)
398765 Rendered queries/_columns.html.erb (6.8ms)
398766 Rendered issues/_list.html.erb (712.7ms)
398767 Rendered issues/_sidebar.html.erb (36.9ms)
398768 Rendered issues/index.html.erb within layouts/base (861.1ms)
398769 Completed 200 OK in 1339ms (Views: 887.0ms | ActiveRecord: 58.2ms)
398770 Started GET "/issues/1170" for 10.1.20.1 at Thu May 23 18:54:09 +0300 2013
398771 Processing by IssuesController#show as HTML
398772 Parameters: {"id"=>"1170"}
398773 Current user: xxxxxx (id=4)
398774 Rendered issues/_action_menu.html.erb (12.7ms)
398775 Rendered plugins/redmine_apijs/app/views/attachments/_links.html.erb (6.9ms)
398776 Rendered issues/show.html.erb within layouts/base (95.9ms)
398777 Completed 500 Internal Server Error in 489ms
398778
398779 ActionView::Template::Error (private method `gsub' called for nil:NilClass):
398780 10: <% slideshowJ += 1 >
398781 11: <
elsif attachment.image? && attachment.readable? >
398782 12: <
img = Magick::Image::read(attachment.diskfile).first >
398783 13: <a href="<
= url_for({:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename}) >" type="<= attachment.content_type >" onclick="retu
398784 14: <
slideshowJ += 1 >
398785 15: <
else >
398786 16: <
= link_to_attachment(attachment, :class => 'icon icon-attachment', :download => true) %>
398787 app/helpers/attachments_helper.rb:31:in `link_to_attachments'
398788 app/views/issues/show.html.erb:89:in `_app_views_issues_show_html_erb___672880400_70115128691420'
398789 app/controllers/issues_controller.rb:119:in `show'
398790 app/controllers/issues_controller.rb:116:in `show'

Actions

Also available in: Atom PDF