Project

General

Profile

Actions

Defect #17217

open

Error when you try to config issue checklist plugin with empty checkboxes

Added by David Verdú over 10 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Environment info:

Environment:
Redmine version 2.5.1.stable
Ruby version 2.0.0-p481 (2014-05-08) [x86_64-linux]
Rails version 3.2.17
Environment production
Database adapter Mysql2
Mysql version 5.5.37-0ubuntu0.14.04.1 (Ubuntu)
SCM:
Subversion 1.8.8
Git 1.9.1
Filesystem
Redmine plugins:
redmine_agile 1.3.1
redmine_ics_export 2.0.0.dev
redmine_issue_checklist 2.0.5
redmine_omniauth_google 0.0.1
redmine_timesheet_plugin 0.7.0

Bug description:

when you go to checklist plugin config page (/settings/plugin/redmine_issue_checklist) and you unselect all the checkboxes and save, an internal error is shown on the screen. The error log message is attached as error_redmine_issue_checklist.txt

The problem consisted of the serialization of an all false options hash into a database column. the all false options hash, serialized into "", was returned to @settings in SettingsController as a "" string insted of an empty hash {}.

It affects all plugins with more than one config option (options are serialized).

Bug solution:

in SettingsControler#plugin I added 2 lines of code that fixes the bug

def plugin
@plugin = Redmine::Plugin.find(params[:id])
unless @plugin.configurable?
render_404
return
end
if request.post?
Setting.send "plugin_#{@plugin.id}=", params[:settings]
flash[:notice] = l(:notice_successful_update)
redirect_to plugin_settings_path(@plugin)
else
@partial = @plugin.settings[:partial]
@settings = Setting.send "plugin_#{@plugin.id}"
settings_options = Setting.available_settings["plugin_#{@plugin.id}"] || {}
@settings = {} if @settings == "" && settings_options["serialized"]
end
rescue Redmine::PluginNotFound
render_404
end

I attach the controller app/controllers/settings_controller.rb file.


Files

error_redmine_issue_checklist.txt (1.31 KB) error_redmine_issue_checklist.txt log message David Verdú, 2014-06-18 10:21
settings_controller.rb (2.7 KB) settings_controller.rb fixed source file David Verdú, 2014-06-18 10:37
fix_empty_settings.patch (939 Bytes) fix_empty_settings.patch patch David Verdú, 2014-06-19 12:22
Actions #1

Updated by David Verdú over 10 years ago

I attach the patch generated by git format-path

Actions

Also available in: Atom PDF