summaryrefslogtreecommitdiff
path: root/lib/gitlab_post_receive.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-15 15:40:31 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-15 15:47:01 +0100
commit7929e8bf4d21b55f4b500b012c5201f947635ddb (patch)
tree3278cbabbbeed5a63c68b10cc6a2b0faa637a85e /lib/gitlab_post_receive.rb
parentf19eee9959bc89c6d9bbb4bf2e4b19158f5c7fd5 (diff)
downloadgitlab-shell-7929e8bf4d21b55f4b500b012c5201f947635ddb.tar.gz
Prevent character encoding issues by sending received changes as raw data.
Diffstat (limited to 'lib/gitlab_post_receive.rb')
-rw-r--r--lib/gitlab_post_receive.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb
index 1c9e8a6..3c601ee 100644
--- a/lib/gitlab_post_receive.rb
+++ b/lib/gitlab_post_receive.rb
@@ -1,6 +1,7 @@
require_relative 'gitlab_init'
require_relative 'gitlab_net'
require 'json'
+require 'base64'
class GitlabPostReceive
attr_reader :config, :repo_path, :changes
@@ -70,8 +71,11 @@ class GitlabPostReceive
end
def update_redis
+ # Encode changes as base64 so we don't run into trouble with non-UTF-8 input.
+ changes = Base64.encode64(@changes)
+
queue = "#{config.redis_namespace}:queue:post_receive"
- msg = JSON.dump({ 'class' => 'PostReceive', 'args' => [@repo_path, @actor, @changes] })
+ msg = JSON.dump({ 'class' => 'PostReceive', 'args' => [@repo_path, @actor, changes] })
if system(*config.redis_command, 'rpush', queue, msg,
err: '/dev/null', out: '/dev/null')
return true