Commit bffc567b authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'archive-404' into 'master'

Return 404 when rendering Repositories#Archive as HTML

Closes #199366

See merge request gitlab-org/gitlab!23926
parents d8a66f30 aaf44e0b
......@@ -21,6 +21,8 @@ class Projects::RepositoriesController < Projects::ApplicationController
end
def archive
return render_404 if html_request?
set_cache_headers
return if archive_not_modified?
......
---
title: Return 404 when repository archive cannot be retrieved
merge_request: 23926
author:
type: fixed
......@@ -88,6 +88,14 @@ describe Projects::RepositoriesController do
end
end
context "when the request format is HTML" do
it "renders 404" do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: "html"
expect(response).to have_gitlab_http_status(:not_found)
end
end
describe 'caching' do
it 'sets appropriate caching headers' do
get_archive
......
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