Project

General

Profile

Actions

Defect #22754

closed

Error while updating issues with boolean custom field through API

Added by Christopher Gabriel almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

We started having trouble while updating an issue through the API. Some client code worked fine for almost 2 years.

Hints?

Started PUT "/issues/1564987.json" for 151.66.249.97 at 2016-05-06 14:53:29 +0200
Processing by IssuesController#update as JSON
  Parameters: {"issue"=>{"due_date"=>"2016-07-05", "id"=>1564987, "custom_fields"=>[{"id"=>207, "value"=>1}], "status_id"=>"30"}, "id"=>"1564987"}
WARNING: Can't verify CSRF token authenticity
  Current user: SOAP (id=165)
  Rendered mailer/issue_edit.text.erb within layouts/mailer (3.9ms)
Completed 500 Internal Server Error in 295ms

ActionView::Template::Error (undefined method `empty?' for 1:Fixnum):
    1: <%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %>
    2: 
    3: <% details_to_strings(@journal.details, true).each do |string| -%>
    4: <%= string %>
    5: <% end -%>
    6: 
  lib/redmine/custom_field_format.rb:98:in `format_value'
  app/helpers/custom_fields_helper.rb:120:in `format_value'
  app/helpers/issues_helper.rb:288:in `show_detail'
  app/helpers/issues_helper.rb:238:in `block in details_to_strings'
  app/helpers/issues_helper.rb:223:in `details_to_strings'
  app/views/mailer/issue_edit.text.erb:3:in `_app_views_mailer_issue_edit_text_erb__2517208687241099780_60946440'
  app/models/mailer.rb:417:in `block in mail'
  app/models/mailer.rb:416:in `mail'
  app/models/mailer.rb:76:in `issue_edit'
  app/models/mailer.rb:427:in `initialize'
  app/models/mailer.rb:440:in `method_missing'
  app/models/journal_observer.rb:26:in `after_create'
  app/models/journal.rb:52:in `save'
  app/models/issue.rb:1362:in `create_journal'
  app/models/issue.rb:965:in `block in save_issue_with_child_records'
  app/models/issue.rb:952:in `save_issue_with_child_records'
  app/controllers/issues_controller.rb:176:in `update'
Actions #1

Updated by Christopher Gabriel almost 8 years ago

More updates:

the custom field 207

"custom_fields"=>[{"id"=>207, "value"=>1}]

is a boolean field. Sending the value of 1 (integer), will lead to the given error 500. Using "1" (string) as value, will work fine.

Actions #2

Updated by Toshi MARUYAMA almost 8 years ago

  • Subject changed from Error while updating issues through API to Error while updating issues with boolean custom field through API
Actions #3

Updated by Toshi MARUYAMA almost 8 years ago

Did you upgrade Redmine?

Actions #4

Updated by Christopher Gabriel almost 8 years ago

I can't do that unfortunately, but I couldn't find reference to this issues in recent version's changelogs. we are running 2.2.4.stable where the problem is raised.

Actions #5

Updated by Toshi MARUYAMA almost 8 years ago

Did problem begin when you upgrading Redmine?

Christopher Gabriel wrote:

we are running 2.2.4.stable where the problem is raised.

2.2.4 is not maintained.

Actions #6

Updated by Jean-Philippe Lang almost 8 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang

I confirm that this is no longer a problem in current versions. The API accepts strings or integers for boolean custom fields. Tests are added in r15443.

Actions

Also available in: Atom PDF