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

Also available in: Atom PDF