Commit 083e8164 authored by Alex Pooley's avatar Alex Pooley

Merge branch 'fix_no_method_error' into 'master'

Fix NoMethodError for RefsController

See merge request gitlab-org/gitlab!79779
parents 97f4fd55 3879534f
......@@ -62,6 +62,6 @@ class Projects::RefsController < Projects::ApplicationController
private
def validate_ref_id
return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
return not_found if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
end
end
......@@ -47,6 +47,14 @@ RSpec.describe Projects::RefsController do
expect(response).to be_not_found
end
context 'when ref is incorrect' do
it 'returns 404 page' do
xhr_get(:json, id: '.')
expect(response).to be_not_found
end
end
context 'when json is requested' do
it 'renders JSON' do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment