Project

General

Profile

Actions

Defect #8700

closed

Internal Error when previewing a note with inline attachment

Added by Rob D about 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-06-28
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Using an issue that has existing image attachments,
  • Press 'Update' to add a new note
  • Enter some text that includes the inline !attached_image.png! as per the text formatting syntax
  • Press 'Preview'

This results in an Internal Error appearing in the Preview box, showing

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

The following was shown in the production.log

ActionView::TemplateError (undefined method `<=>' for nil:NilClass) on line #3 of app/views/previews/issue.html.erb:
1: <% if @notes %>
2:      <fieldset class="preview"><legend><%= l(:field_notes) %></legend>
3:              <%= textilizable @notes, :attachments => @attachements, :object => @issue %>
4:      </fieldset>
5: <% end %>
6:

    app/helpers/application_helper.rb:510:in `parse_inline_attachments'
    app/helpers/application_helper.rb:508:in `gsub!'
    app/helpers/application_helper.rb:508:in `parse_inline_attachments'
    app/helpers/application_helper.rb:464:in `send'
    app/helpers/application_helper.rb:464:in `textilizable'
    app/helpers/application_helper.rb:463:in `each'
    app/helpers/application_helper.rb:463:in `textilizable'
    app/helpers/application_helper.rb:483:in `parse_non_pre_blocks'
    app/helpers/application_helper.rb:462:in `textilizable'
    app/views/previews/issue.html.erb:3
    app/controllers/previews_controller.rb:33:in `issue'
    /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:95:in `process_request'
    ...

System information:

Ubuntu 10.04 server
Redmine 1.2.0
Rails 2.3.11
Mysql 5.1.41

So, looking at application_helper.rb ...

attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse

This is on a test server where I have migrated data, including files, from ClearQuest, and the files do not have created_on data, which complies with the attachments table:

`created_on` datetime DEFAULT NULL,

Actions #1

Updated by Etienne Massip about 13 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

created_on column should never be null, this column has been set to nullable since its type is timestamp, which implies a default value of NOW() at insertion time.

Just set a value to your created_on column.

Actions

Also available in: Atom PDF