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
..
blob.go RepoAssignment ensure to close before overwrite (#19449) 2 years ago
branch.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
collaborators.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
commits.go Pass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461) 2 years ago
file.go Add API to serve blob or LFS file content (#19689) 2 years ago
fork.go Move access and repo permission to models/perm/access (#19350) 2 years ago
git_hook.go Move macaron to chi (#14293) 3 years ago
git_ref.go Multiple Escaping Improvements (#17551) 3 years ago
hook.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
hook_test.go Decouple unit test, remove intermediate `unittestbridge` package (#17662) 3 years ago
issue.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
issue_comment.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
issue_label.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
issue_reaction.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
issue_stopwatch.go Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163) 2 years ago
issue_subscription.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
issue_tracked_time.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
key.go Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163) 2 years ago
label.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
language.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
main_test.go Use queue instead of memory queue in webhook send service (#19390) 2 years ago
migrate.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
milestone.go Move milestone to models/issues/ (#19278) 2 years ago
mirror.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
notes.go RepoAssignment ensure to close before overwrite (#19449) 2 years ago
patch.go Add "Allow edits from maintainer" feature (#18002) 2 years ago
pull.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
pull_review.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
release.go improvement some release related code (#19867) 2 years ago
release_attachment.go improvement some release related code (#19867) 2 years ago
release_tags.go Renamed ctx.User to ctx.Doer. (#19161) 2 years ago
repo.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
repo_test.go Renamed ctx.User to ctx.Doer. (#19161) 2 years ago
star.go Renamed ctx.User to ctx.Doer. (#19161) 2 years ago
status.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
subscriber.go Renamed ctx.User to ctx.Doer. (#19161) 2 years ago
tag.go Renamed ctx.User to ctx.Doer. (#19161) 2 years ago
teams.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
topic.go Some repository refactors (#17950) 3 years ago
transfer.go Move almost all functions' parameter db.Engine to context.Context (#19748) 2 years ago
tree.go Propagate context and ensure git commands run in request context (#17868) 2 years ago
wiki.go Make git.OpenRepository accept Context (#19260) 2 years ago