Project

General

Profile

Defect #28689 » 28689-v2.diff

patch (also supports Ruby 2.2) - Go MAEDA, 2018-05-06 07:31

View differences:

Gemfile (working copy)
gem "roadie", "~> 3.2.1"
gem "mimemagic"
gem "mail", "~> 2.6.4"
gem "csv", "~> 1.0.1" if RUBY_VERSION >= "2.5"
gem "csv", "~> 1.0.2" if RUBY_VERSION >= "2.3"
gem "nokogiri", "~> 1.8.0"
gem "i18n", "~> 0.7.0"
app/controllers/imports_controller.rb (working copy)
redirect_to import_mapping_path(@import)
end
rescue CSV::MalformedCSVError => e
flash.now[:error] = l(:error_invalid_csv_file_or_settings)
rescue ArgumentError, EncodingError => e
flash.now[:error] = l(:error_invalid_file_encoding, :encoding => ERB::Util.h(@import.settings['encoding']))
# TODO: Remove ArgumentError when support for Ruby 2.2 is dropped (#28689)
rescue CSV::MalformedCSVError, ArgumentError, EncodingError => e
if e.is_a?(CSV::MalformedCSVError) && e.message !~ /Invalid byte sequence/
flash.now[:error] = l(:error_invalid_csv_file_or_settings)
else
flash.now[:error] = l(:error_invalid_file_encoding, :encoding => ERB::Util.h(@import.settings['encoding']))
end
rescue SystemCallError => e
flash.now[:error] = l(:error_can_not_read_import_file)
end
(2-2/2)