Project

General

Profile

Actions

Defect #14282

closed

Wrong validation while updating custom field through API

Added by Christopher Gabriel almost 11 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Custom fields
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

While updating an issue's custom field (both integer or float type, both with size validation) we get a 500 Internal Server Error.

From the production log (some values are X's for privacy reasons):


Started PUT "/issues/200043.json" for 172.50.1.78 at Fri Jun 14 11:53:25 +0200 2013
Processing by IssuesController#update as JSON
  Parameters: {"id"=>"200043", "issue"=>{"notes"=>"XXXXX", "subject"=>"XXX", "id"=>200043, "custom_fields"=>[{"id"=>73, "value"=>"X"}, {"id"=>90, "value"=>"XXXXX"}, {"id"=>7, "value"=>"XXXX"}, {"id"=>6, "value"=>"XXX"}, {"id"=>89, "value"=>"XXXX"}, {"id"=>13, "value"=>"XXXX"}, {"id"=>43, "value"=>"XXXX"}, {"id"=>95, "value"=>"I"}, {"id"=>14, "value"=>"XXXX"}, {"id"=>52, "value"=>"XXXX"}, {"id"=>74, "value"=>"XX"}, {"id"=>96, "value"=>"XX"}, {"id"=>15, "value"=>"XXXX"}, {"id"=>16, "value"=>"XXXXX"}, {"id"=>17, "value"=>"XXXX"}, {"id"=>101, "value"=>11}, {"id"=>105, "value"=>"XXXX"}, {"id"=>123, "value"=>110.0}, {"id"=>103, "value"=>2012}, {"id"=>21, "value"=>10.0}, {"id"=>22, "value"=>1}, {"id"=>41, "value"=>"XXXXX"}, {"id"=>35, "value"=>"XXXXX"}, {"id"=>35, "value"=>"XXXX"}, {"id"=>86, "value"=>0}, {"id"=>87, "value"=>0}, {"id"=>48, "value"=>"XXXXXX"}, {"id"=>71, "value"=>"XXXX"}, {"id"=>22, "value"=>"XXXX"}], "status_id"=>"88"}, "key"=>"XXXXX"}
 Current user: SOAP (id=165)
Completed 500 Internal Server Error in 571ms

NoMethodError (undefined method `length' for 10.0:Float):
  app/models/custom_field.rb:310:in `validate_field_value_format'
  app/models/custom_field.rb:288:in `validate_field_value'
  app/models/custom_field_value.rb:46:in `validate_value'
  lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb:125:in `each'
  lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb:125:in `validate_custom_field_values'
  app/models/issue.rb:965: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'

Seems that our custom field with id 21 (with has a validator for the size, 0 -> 10) has the issues.

Any hints?

Thanks.

Actions #1

Updated by Christopher Gabriel almost 11 years ago

Environment:
Redmine version 2.2.4.stable
Ruby version 1.8.7 (i486-linux)
Rails version 3.2.13
Environment production
Database adapter MySQL
Redmine plugins:
redmine_contacts 3.2.1-light
redmine_contacts_helpdesk 2.2.0-pro
redmine_importer 1.0

Actions #2

Updated by Julian Faude almost 11 years ago

I could not reproduce that on 2.3.0.stable:

Started PUT "/issues/54.json" for XXX at Sun Jun 16 16:42:50 +0200 2013
Processing by IssuesController#update as JSON
Parameters: {"id"=>"54", "issue"=>{"id"=>54, "description"=>"Test", "custom_fields"=>[{"id"=>1, "name"=>"TestInt", "value"=>"22"}, {"id"=>2, "name"=>"TestFloat", "value"=>"28.0"}], "priority"=>{"id"=>2, "name"=>"Normal"}, "done_ratio"=>0, "parent"=>{"id"=>34}, "author"=>{"id"=>4, "name"=>"XXX"}, "tracker"=>{"id"=>5, "name"=>"XXX"}, "updated_on"=>"2013-06-16T12:20:36Z", "project"=>{"id"=>3, "name"=>"XXX"}, "subject"=>"Subject changed", "start_date"=>"2013-03-27", "created_on"=>"2013-03-27T15:28:41Z", "status"=>{"id"=>1, "name"=>"Neu"}}}
Current user: XXX (id=3)
Rendered mailer/_issue.text.erb (141.8ms)
Rendered mailer/issue_edit.text.erb within layouts/mailer (146.6ms)
Rendered text template (0.0ms)
Completed 200 OK in 631ms (Views: 0.9ms | ActiveRecord: 26.1ms)

I changed TestInt as well as TestFloat.

Environment:
Redmine version 2.3.0.stable
Ruby version 1.8.7 (i386-linux)
Rails version 3.2.13
Environment production
Database adapter MySQL
Redmine plugins:
redmine_contacts 3.2.3-light
redmine_contacts_helpdesk 2.2.2-pro
redmine_custom_workflows 0.0.4
redmine_issue_control_panel 0.3.0

Actions #3

Updated by Christopher Gabriel almost 11 years ago

So you're suggesting to upgrade?

Actions #4

Updated by Go MAEDA almost 6 years ago

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

I could not reproduce on the trunk (r17367). Please reopen this issue if the problem still persists on the latest versions.

Actions

Also available in: Atom PDF