OSDN Git Service

fix: UTF-8 encoding error
authortsl0922 <tsl0922@gmail.com>
Sat, 20 Apr 2013 01:18:37 +0000 (09:18 +0800)
committertsl0922 <tsl0922@gmail.com>
Fri, 3 May 2013 02:58:53 +0000 (10:58 +0800)
lib/gitlab/backend/grack_auth.rb

index 8b43b60..6d87df1 100644 (file)
@@ -109,6 +109,8 @@ module Grack
       else
         input = @request.body.read
       end
+      # force utf-8 encoding
+      input.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')
       # Need to reset seek point
       @request.body.rewind
       /refs\/heads\/([\w\.-]+)/.match(input).to_a.last