]> source.dussan.org Git - redmine.git/commitdiff
Fix wrong variable name in Import#set_default_settings (#34718).
authorGo MAEDA <maeda@farend.jp>
Fri, 7 Jan 2022 10:06:28 +0000 (10:06 +0000)
committerGo MAEDA <maeda@farend.jp>
Fri, 7 Jan 2022 10:06:28 +0000 (10:06 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@21354 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/import.rb
test/unit/issue_import_test.rb

index e048867c80d0bf27c80ddf0eef8a7fc9931cbe2b..f64fe7d0679ae3a9f4d16cbc46a102ea58fa292e 100644 (file)
@@ -72,7 +72,7 @@ class Import < ActiveRecord::Base
 
         separator = [',', ';'].max_by {|sep| content.count(sep)}
 
-        guessed_encoding = Redmine::CodesetUtil.guess_encoding(file_content)
+        guessed_encoding = Redmine::CodesetUtil.guess_encoding(content)
         encoding =
           (guessed_encoding && (
             Setting::ENCODINGS.detect {|e| e.casecmp?(guessed_encoding)} ||
index 3f98f03725de4ae287d0e0d3ef1c4db3f3d704d5..79038ace49b7c0f082785bd526c88e9d4b407dac 100644 (file)
@@ -414,6 +414,9 @@ class IssueImportTest < ActiveSupport::TestCase
 
   def test_set_default_settings_should_guess_encoding
     import = generate_import('import_iso8859-1.csv')
+    user = User.generate!(:language => 'ja')
+    import.user = user
+    assert_equal 'CP932', lu(user, :general_csv_encoding)
     with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
       import.set_default_settings
       guessed_encoding = import.settings['encoding']