anjlab / redmine_inline_note_images_plugin

Redmine plugin for inline note images display
12 stars 11 forks source link

Exception when opening Issues #12

Closed hexa2k9 closed 11 years ago

hexa2k9 commented 11 years ago

I see an Exception on the Logs when I try to open an Issue having a file attached (in this case a pdf).

The Exceptions seems to have something to do with this commit 5fe2aad7d20b2a95b19b0084bd99e6c6e5c624ab as it was working fine before.

I'm using Redmine 2.2.3.stable.11369, Ruby 1.9.3

Started GET "/issues/9627823" for 127.0.0.1 at 2013-04-24 13:41:02 +0200
Processing by IssuesController#show as HTML
  Parameters: {"id"=>"9627823"}
  Current user: xxx (id=1268)
  Rendered issues/_action_menu.html.erb (3.1ms)
  Rendered attachments/_links.html.erb (2.3ms)
  Rendered plugins/redmine_issue_checklist/app/views/issues/_checklist.html.erb (1.5ms)
  Rendered issue_relations/_form.html.erb (1.2ms)
  Rendered issues/_relations.html.erb (5.1ms)
  Rendered plugins/redmine_inline_note_images_plugin/app/views/hooks/inline_image_hook/_inline_images_paste.erb (0.7ms)
  Rendered plugins/redmine_inline_note_images_plugin/app/views/hooks/inline_image_hook/_inline_images_paste.erb (0.7ms)
  Rendered plugins/redmine_inline_note_images_plugin/app/views/hooks/inline_image_hook/_inline_images_paste.erb (4.2ms)
  Rendered issues/_history.html.erb (14.5ms)
  Rendered issues/show.html.erb within layouts/base (45.5ms)
Completed 500 Internal Server Error in 93ms

ActionView::Template::Error (undefined method `image?' for nil:NilClass):
    3:  <% attachments.push Attachment.find_by_id a.prop_key %>
    4: <% end %>
    5:
    6: <% images = attachments.select(&:image?) %>
    7: <% if images.any? %>
    8:  <div class="journal attachments">
    9:  <% images.each do |image| %>
  lib/redmine/hook.rb:111:in `block in render_on'
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:158:in `call_hook'
  app/views/issues/_history.html.erb:19:in `block in _app_views_issues__history_html_erb__135390176_96662450'
  app/views/issues/_history.html.erb:2:in `each'
  app/views/issues/_history.html.erb:2:in `_app_views_issues__history_html_erb__135390176_96662450'
  app/views/issues/show.html.erb:124:in `_app_views_issues_show_html_erb___789035019_89451820'
  app/controllers/issues_controller.rb:119:in `block (2 levels) in show'
  app/controllers/issues_controller.rb:116:in `show'
logical-and commented 11 years ago

Did you removed attachments?

hexa2k9 commented 11 years ago

I think for this particular Issue there was an attachement which was removed and then replaced by another one.

so there's a deleted attachement and another one with a new name.

logical-and commented 11 years ago

Ok, I understand. I'll fix it asap.

ghost commented 11 years ago

I second this, i deleted an attachment through the redmine interface and then i started throwing this error.

serggl commented 11 years ago

The fix for this is attached to #14