Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-26 10:34:47 +0300
committerStan Hu <stanhu@gmail.com>2019-04-15 01:26:25 +0300
commite675fe4621bc5668d5d9b72961a38be72baf23dd (patch)
treecb4c8593d12c0bfa3cc223973052d4a657fb510c /spec/controllers
parentd2d9fb9a863909d1002029ddd19247b52264ab4d (diff)
Validate refs used in controllers don't have spaces
This avoids an unnecessary call to Gitaly and reduces gRPC errors. * Closes https://gitlab.com/gitlab-org/gitaly/issues/1425 * Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58572
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/tree_controller_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb
index 78201498eaa..6d9a0be6f2e 100644
--- a/spec/controllers/projects/tree_controller_spec.rb
+++ b/spec/controllers/projects/tree_controller_spec.rb
@@ -72,6 +72,26 @@ describe Projects::TreeController do
end
end
+ describe 'GET show with whitespace in ref' do
+ render_views
+
+ let(:id) { "this ref/api/responses" }
+
+ it 'does not call make a Gitaly request' do
+ allow(::Gitlab::GitalyClient).to receive(:call).and_call_original
+ expect(::Gitlab::GitalyClient).not_to receive(:call).with(anything, :commit_service, :find_commit, anything, anything)
+
+ get(:show,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ })
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+ end
+
describe 'GET show with blob path' do
render_views