Project

General

Profile

Defect #28689 » 28689.diff

patch - Go MAEDA, 2018-05-06 04:43

View differences:

Gemfile (working copy)
13 13
gem "roadie", "~> 3.2.1"
14 14
gem "mimemagic"
15 15
gem "mail", "~> 2.6.4"
16
gem "csv", "~> 1.0.1" if RUBY_VERSION >= "2.5"
16
gem "csv", "~> 1.0.2"
17 17

  
18 18
gem "nokogiri", "~> 1.8.0"
19 19
gem "i18n", "~> 0.7.0"
app/controllers/imports_controller.rb (working copy)
50 50
      redirect_to import_mapping_path(@import)
51 51
    end
52 52

  
53
  rescue CSV::MalformedCSVError => e
54
    flash.now[:error] = l(:error_invalid_csv_file_or_settings)
55
  rescue ArgumentError, EncodingError => e
56
    flash.now[:error] = l(:error_invalid_file_encoding, :encoding => ERB::Util.h(@import.settings['encoding']))
53
  rescue CSV::MalformedCSVError, EncodingError => e
54
    if e.is_a?(CSV::MalformedCSVError) && e.message !~ /Invalid byte sequence/
55
      flash.now[:error] = l(:error_invalid_csv_file_or_settings)
56
    else
57
      flash.now[:error] = l(:error_invalid_file_encoding, :encoding => ERB::Util.h(@import.settings['encoding']))
58
    end
57 59
  rescue SystemCallError => e
58 60
    flash.now[:error] = l(:error_can_not_read_import_file)
59 61
  end
(1-1/2)