From afe98ae74ab13d11908e74ada1d10dccc333228b Mon Sep 17 00:00:00 2001 From: gitlabhq Date: Tue, 25 Oct 2011 07:32:02 +0300 Subject: Issue #149 fixed --- lib/commit_ext.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/commit_ext.rb b/lib/commit_ext.rb index c175fa0cc2d..e09dbdaf8ef 100644 --- a/lib/commit_ext.rb +++ b/lib/commit_ext.rb @@ -1,8 +1,10 @@ module CommitExt - # Cause of encoding rails truncate raise error - # this method is temporary decision - def truncated_message(size = 80) - message.length > size ? (message[0..(size - 1)] + "...") : message + def safe_message + message.encode("UTF-8", + :invalid => :replace, + :undef => :replace, + :universal_newline => true, + :replace => "") rescue "-- invalid encoding for commit message" end -- cgit v1.2.1