Merge branch 'lfs-noauth-public-repo' into 'master'

lfs: do not require auth for public repositories

Closes #23360

See merge request !8824
This commit is contained in:
Rémy Coutable 2017-02-08 10:15:11 +00:00
commit 1a1381a477
3 changed files with 9 additions and 0 deletions

View file

@ -48,6 +48,10 @@ class Projects::LfsApiController < Projects::GitHttpClientController
objects.each do |object|
if existing_oids.include?(object[:oid])
object[:actions] = download_actions(object)
if Guest.can?(:download_code, project)
object[:authenticated] = true
end
else
object[:error] = {
code: 404,

View file

@ -0,0 +1,4 @@
---
title: Support unauthenticated LFS object downloads for public projects
merge_request: 8824
author: Ben Boeckel

View file

@ -600,6 +600,7 @@ describe 'Git LFS API and storage' do
expect(json_response).to eq('objects' => [
{ 'oid' => sample_oid,
'size' => sample_size,
'authenticated' => true,
'actions' => {
'download' => {
'href' => "#{project.http_url_to_repo}/gitlab-lfs/objects/#{sample_oid}",