diff options
author | Go MAEDA <maeda@farend.jp> | 2020-12-05 00:21:15 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-12-05 00:21:15 +0000 |
commit | 135fd7b79f7a45fa3741f95aa53af5457d59b2dd (patch) | |
tree | eb19c94c6c44581a957e3da40c99e4a92c3f953e | |
parent | bef2644f88ca8ca0a55e5f9a35a81c1f3948d26d (diff) | |
download | redmine-135fd7b79f7a45fa3741f95aa53af5457d59b2dd.tar.gz redmine-135fd7b79f7a45fa3741f95aa53af5457d59b2dd.zip |
CSV import raises an exception if CSV header has empty columns (#22913, #34326).
git-svn-id: http://svn.redmine.org/redmine/trunk@20576 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/imports_controller.rb | 2 | ||||
-rw-r--r-- | test/fixtures/files/import_issues_auto_mapping.csv | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 9431ca098..d295f5ebc 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -173,7 +173,7 @@ class ImportsController < ApplicationController return if @import.settings['encoding'].blank? mappings = @import.settings['mapping'] ||= {} - headers = @import.headers.map(&:downcase) + headers = @import.headers.map{|header| header&.downcase} # Core fields import_type::AUTO_MAPPABLE_FIELDS.each do |field_nm, label_nm| diff --git a/test/fixtures/files/import_issues_auto_mapping.csv b/test/fixtures/files/import_issues_auto_mapping.csv index 49785f7a4..ba45a0ae7 100644 --- a/test/fixtures/files/import_issues_auto_mapping.csv +++ b/test/fixtures/files/import_issues_auto_mapping.csv @@ -1,2 +1,2 @@ -priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6 -High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2 +priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6; +High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2;"Column with empty header" |