summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GITLAB_SHELL_VERSION2
-rw-r--r--lib/api/helpers.rb4
-rw-r--r--lib/api/internal.rb2
-rw-r--r--spec/requests/api/internal_spec.rb3
4 files changed, 7 insertions, 4 deletions
diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION
index 437459cd94c..73462a5a134 100644
--- a/GITLAB_SHELL_VERSION
+++ b/GITLAB_SHELL_VERSION
@@ -1 +1 @@
-2.5.0
+2.5.1
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index a50ee4659a3..228a719fbdf 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -83,7 +83,7 @@ module API
end
def authenticate_by_gitlab_shell_token!
- unauthorized! unless secret_token == params['secret_token']
+ unauthorized! unless secret_token == params['secret_token'].try(:chomp)
end
def authenticated_as_admin!
@@ -236,7 +236,7 @@ module API
end
def secret_token
- File.read(Rails.root.join('.gitlab_shell_secret'))
+ File.read(Rails.root.join('.gitlab_shell_secret')).chomp
end
def handle_member_errors(errors)
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 04ff049989b..ba3fe619b92 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -73,6 +73,8 @@ module API
get "/broadcast_message" do
if message = BroadcastMessage.current
present message, with: Entities::BroadcastMessage
+ else
+ {}
end
end
end
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 10b467d85fd..4c7d15d6594 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -32,7 +32,8 @@ describe API::API, api: true do
it do
get api("/internal/broadcast_message"), secret_token: secret_token
- expect(response.status).to eq(404)
+ expect(response.status).to eq(200)
+ expect(json_response).to be_empty
end
end
end