プロジェクト

全般

プロフィール

Vote #81038

完了

500 error when attempting to create custom field enumeration with empty name

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Custom fields_14
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
14
version_id:
152
issue_org_id:
33930
author_id:
3866
assigned_to_id:
332
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
160
ステータス-->[Closed]

説明

When editing the list of possible values for a key/value custom field type, clicking "Add" with the field empty will lead to a HTTP 500 error from Redmine. An example stack trace is attached. The error is confirmed on current master.

It should at least be fixed that Redmine does not create an HTTP 500 error, an error message that the value must not be empty would be better.

Started POST "/custom_fields/1/enumerations" for ::1 at 2020-08-30 17:47:21 +0200
Processing by CustomFieldEnumerationsController#create as JS
  Parameters: {"utf8"=>"✓", "custom_field_enumeration"=>{"name"=>""}, "commit"=>"Add", "custom_field_id"=>"1"}
  Token Update All (2.5ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-08-30 17:47:21' WHERE `tokens`.`user_id` = 1 AND `tokens`.`value` = '' AND `tokens`.`action` = 'session'
   (0.3ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
  User Load (0.3ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 1 LIMIT 1
  Current user: admin (id=1)
  CustomField Load (0.3ms)  SELECT  `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`id` = 1 LIMIT 1
   (0.3ms)  BEGIN
   (0.2ms)  ROLLBACK
  Rendering custom_field_enumerations/create.js.erb
  Rendering custom_field_enumerations/index.html.erb
  CustomFieldEnumeration Load (0.4ms)  SELECT `custom_field_enumerations`.* FROM `custom_field_enumerations` WHERE `custom_field_enumerations`.`custom_field_id` = 1 ORDER BY `custom_field_enumerations`.`position` ASC
  Rendered custom_field_enumerations/index.html.erb (8.8ms)
  Rendered custom_field_enumerations/create.js.erb (13.7ms)
Completed 500 Internal Server Error in 100ms (ActiveRecord: 4.4ms)



ActionView::Template::Error (No route matches {:action=>"update", :controller=>"custom_field_enumerations", :custom_field_id=>"1", :id=>nil}, missing required keys: [:id]):
    14:         <%= check_box_tag "custom_field_enumerations[#{value.id}][active]", 1, value.active? %>
    15:         <%= l(:field_active) %>
    16:       
    17:       <%= delete_link custom_field_enumeration_path(@custom_field, value) %>
    18:     
    19:   <% end %>
    20:   

app/views/custom_field_enumerations/index.html.erb:17:in `block (2 levels) in _app_views_custom_field_enumerations_index_html_erb___3882666770216567044_70211539369080'
app/views/custom_field_enumerations/index.html.erb:7:in `each_with_index'
app/views/custom_field_enumerations/index.html.erb:7:in `block in _app_views_custom_field_enumerations_index_html_erb___3882666770216567044_70211539369080'
app/views/custom_field_enumerations/index.html.erb:4:in `_app_views_custom_field_enumerations_index_html_erb___3882666770216567044_70211539369080'
app/views/custom_field_enumerations/create.js.erb:1:in `_app_views_custom_field_enumerations_create_js_erb__3749928945083050900_70211553777600'
lib/redmine/sudo_mode.rb:64:in `sudo_mode'

journals

--------------------------------------------------------------------------------
Here is a patch written by goh, rbtgr and me.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Validation errors are now handled properly with the patch. Setting the target version to 4.2.0.

!{width: 486px; border: 1px solid grey;}.33930-validation.png!
--------------------------------------------------------------------------------
Committed the patch. Thank you for fixing the issue.
--------------------------------------------------------------------------------

Admin Redmine さんが4年以上前に更新

  • カテゴリCustom fields_14 にセット
  • 対象バージョン4.2.0_152 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0