From f1c9b05868cb6ecc72c1dc6f7de0583ca7f95faa Mon Sep 17 00:00:00 2001 From: tsl0922 <tsl0922@gmail.com> Date: Fri, 3 May 2013 11:31:23 +0800 Subject: [PATCH] better fix for encoding error --- lib/gitlab/backend/grack_auth.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index 6d87df17e757..6a411aabcc63 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -109,11 +109,9 @@ def current_ref 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 + /refs\/heads\/([\w\.-]+)/n.match(input.force_encoding('ascii-8bit')).to_a.last end def project -- GitLab