You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qwerty287 df9612bb53
Add API to serve blob or LFS file content (#19689)
* Add LFS API

* Update routers/api/v1/repo/file.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>

* Apply suggestions

* Apply suggestions

* Update routers/api/v1/repo/file.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>

* Report errors

* ADd test

* Use own repo for test

* Use different repo name

* Improve handling

* Slight restructures

1. Avoid reading the blob data multiple times
2. Ensure that caching is only checked when about to serve the blob/lfs
3. Avoid nesting by returning early
4. Make log message a bit more clear
5. Ensure that the dataRc is closed by defer when passed to ServeData

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago
..
admin Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
misc Fix nodeinfo caching and prevent NPE if cache non-existent (#19721) 2 years ago
notify Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
org Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
packages Hide private repositories in packages (#19584) 2 years ago
repo Add API to serve blob or LFS file content (#19689) 2 years ago
settings Make mirror feature more configurable (#16957) 3 years ago
swagger Add API to query collaborators permission for a repository (#18761) 2 years ago
user Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
utils Use middleware to open gitRepo (#19559) 2 years ago
api.go Add API to serve blob or LFS file content (#19689) 2 years ago
auth.go Remove legacy `+build:` constraint (#19582) 2 years ago
auth_windows.go Let web and API routes have different auth methods group (#19168) 2 years ago