Redmine-Periodic-Task icon indicating copy to clipboard operation
Redmine-Periodic-Task copied to clipboard

potential issue when field description is empty/null

Open ka7 opened this issue 8 years ago • 1 comments

when i upgraded my old version, the periodc-task dumped in cron-mode.

Cron-cmd: :

--- cd /opt/redmine/redmine-3.3.3; rake redmine:check_periodictasks RAILS_ENV=production

--- rake aborted! TypeError: can't dup NilClass /opt/redmine/redmine-3.3.3/plugins/periodictask/lib/scheduled_tasks_checker.rb:11:in dup' /opt/redmine/redmine-3.3.3/plugins/periodictask/lib/scheduled_tasks_checker.rb:11:in block in checktasks!' /var/lib/gems/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/relation/delegation.rb:46:in each' /var/lib/gems/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/relation/delegation.rb:46:in each' /opt/redmine/redmine-3.3.3/plugins/periodictask/lib/scheduled_tasks_checker.rb:4:in checktasks!' /opt/redmine/redmine-3.3.3/plugins/periodictask/lib/tasks/periodictask.rake:11:in block (2 levels) in <top (required)>' /var/lib/gems/2.1.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>' Tasks: TOP => redmine:check_periodictasks (See full trace by running task with --trace)

--- content of DB-table ---

--- MariaDB [redmine]> select description from periodictasks; +-------------+ | description | +-------------+ | | <- some space/blank | NULL | <-some null | NULL | ...

-- fixed with patch -- ( now worksforme) ---a/lib/scheduled_tasks_checker.rb +++ b/lib/scheduled_tasks_checker.rb @@ -8,7 +8,8 @@ class ScheduledTasksChecker # Copy subject and description and replace variables subject = task.subject.dup - description = task.description.dup + description = (task.description || "").dup subject.gsub!('**DAY**', now.strftime("%d")) subject.gsub!('**WEEK**', now.strftime("%W")) subject.gsub!('**MONTH**', now.strftime("%m"))

ka7 avatar May 03 '17 17:05 ka7

I'll add the patch when I have some time. Thanks for the thorough report

jperelli avatar Jun 20 '17 01:06 jperelli