Skip to content

Allow downloading LFS binary data via API

What does this MR do and why?

Allow downloading files tracked with Git LFS via API

When a request is made with the lfs query parameter for files that are tracked via Git LFS, the reponse should be the binary data rather than the pointer file

Contributes to: #27892 (closed)

How to set up and validate locally

  1. Set up a project with lfs enabled
  2. Add some files tracked with git lfs For example
git lfs track `*.txt`
echo 'hello' > hello.txt
  1. Make a request to the files api with the lfs parameter for the binary data and see that the response is the file contents(e.g For example
curl 127.0.0.1:3000/api/v4/projects/23/repository/files/hello.txt/raw?lfs=true
=> hello
  1. Make a request to the files api without the lfs parameter (and/or lfs=false) and see that response is the lfs text pointer

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #27892 (closed)

Edited by Jerry Seto

Merge request reports