1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-30 04:09:38 +00:00

Make sure that #scm_iconv returns a string with the target encoding (#14534).

filechanges.find_by_revision_and_path fails with SQLite if arguments are not UTF-8 encoded.

git-svn-id: http://svn.redmine.org/redmine/trunk@13902 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-01-18 16:16:23 +00:00
parent 6cc1f2be54
commit 9915962356
2 changed files with 2 additions and 1 deletions

View File

@ -283,7 +283,7 @@ module Redmine
def scm_iconv(to, from, str)
return nil if str.nil?
return str if to == from
return str if to == from && str.encoding.to_s == from
str.force_encoding(from)
begin
str.encode(to)

View File

@ -179,6 +179,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
assert_kind_of Redmine::Scm::Adapters::Entries, entries
assert_equal 3, entries.size
assert_equal entries[2].name, "README"
assert_equal 'UTF-8', entries[2].path.encoding.to_s
assert_equal entries[2].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22)
assert_equal entries[2].lastrev.identifier, '3'
assert_equal entries[2].lastrev.revision, '3'