Update copy when snippet git feature disabled

parent 94c735f6
......@@ -121,7 +121,7 @@ module Repositories
def snippet_request_allowed?
if repo_type.snippet? && Feature.disabled?(:version_snippets, user)
Gitlab::AppLogger.info('Snippet access attempt with feature disabled')
render plain: 'The project you were looking for could not be found.', status: :not_found
render plain: 'Snippet git access is disabled.', status: :forbidden
end
end
end
......
---
title: Update copy when snippet git feature disabled
merge_request: 28913
author:
type: changed
......@@ -109,7 +109,7 @@ module API
# group resources based on its IP restrictions
post "/allowed" do
if repo_type.snippet? && Feature.disabled?(:version_snippets, actor.user)
break response_with_status(code: 404, success: false, message: 'The project you were looking for could not be found.')
break response_with_status(code: 401, success: false, message: 'Snippet git access is disabled.')
end
# It was moved to a separate method so that EE can alter its behaviour more
......
......@@ -145,13 +145,13 @@ describe Repositories::GitHttpController do
describe 'GET #info_refs' do
let(:params) { container_params.merge(service: 'git-upload-pack') }
it 'returns 404' do
it 'returns 403' do
expect(controller).not_to receive(:access_check)
get :info_refs, params: params
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to eq "The project you were looking for could not be found."
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq 'Snippet git access is disabled.'
end
end
......@@ -162,13 +162,13 @@ describe Repositories::GitHttpController do
allow(controller).to receive(:access_check).and_return(nil)
end
it 'returns 404' do
it 'returns 403' do
expect(controller).not_to receive(:access_check)
post :git_upload_pack, params: params
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).to eq "The project you were looking for could not be found."
expect(response).to have_gitlab_http_status(:forbidden)
expect(response.body).to eq 'Snippet git access is disabled.'
end
end
end
......
......@@ -325,12 +325,12 @@ describe API::Internal::Base do
shared_examples 'snippets with disabled feature flag' do
context 'when feature flag :version_snippets is disabled' do
it 'returns 404' do
it 'returns 401' do
stub_feature_flags(version_snippets: false)
subject
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
......
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