scm: prevent PostgreSQL or Ruby 1.9 errors if paths is invalid UTF-8.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5475 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-04-16 06:44:35 +00:00
parent a78b12706a
commit 5512e397ee

View File

@ -1,5 +1,5 @@
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
# Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -25,6 +25,11 @@ class Change < ActiveRecord::Base
changeset.repository.relative_path(path)
end
def before_validation
self.path = Redmine::CodesetUtil.replace_invalid_utf8(self.path)
self.from_path = Redmine::CodesetUtil.replace_invalid_utf8(self.from_path)
end
def init_path
self.path ||= ""
end