summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-10-25 07:32:02 +0300
committergitlabhq <m@gitlabhq.com>2011-10-25 07:32:02 +0300
commitafe98ae74ab13d11908e74ada1d10dccc333228b (patch)
tree59b347ca22fa523d5bdc2d8603a15502e397b90b /lib
parent5baa5fad0a1c6e2b8790f07f62c088fd505406d9 (diff)
downloadgitlab-ce-afe98ae74ab13d11908e74ada1d10dccc333228b.tar.gz
Issue #149 fixed
Diffstat (limited to 'lib')
-rw-r--r--lib/commit_ext.rb10
1 files changed, 6 insertions, 4 deletions
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